https://github.com/itsdoot/varint-benchmark
A rendition of https://steinborn-me.pages.dev/posts/performance/how-fast-can-you-write-a-varint/ but in Rust this time.
https://github.com/itsdoot/varint-benchmark
Last synced: over 1 year ago
JSON representation
A rendition of https://steinborn-me.pages.dev/posts/performance/how-fast-can-you-write-a-varint/ but in Rust this time.
- Host: GitHub
- URL: https://github.com/itsdoot/varint-benchmark
- Owner: ItsDoot
- Created: 2021-08-22T08:47:15.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-22T20:51:15.000Z (almost 5 years ago)
- Last Synced: 2025-02-02T20:52:30.191Z (over 1 year ago)
- Language: Rust
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# VarInt Encoding Benchmark
This repo was inspired by https://steinborn-me.pages.dev/posts/performance/how-fast-can-you-write-a-varint/ but using Rust rather than Java.
# Results
All benchmarks were performed with a Ryzen 1700 CPU.
```
test tests::blended ... bench: 3,059,360 ns/iter (+/- 21,405)
test tests::bungee ... bench: 7,298,080 ns/iter (+/- 309,710)
test tests::lucky5 ... bench: 2,479,300 ns/iter (+/- 15,811)
test tests::velocity ... bench: 6,171,420 ns/iter (+/- 158,624)
```
## What about an array?
I was curious what the differences are with using an `[u8; 5]` array as the write buffer rather than a `Vec`. This was the outcome:
```
test tests::blended ... bench: 2,017,167 ns/iter (+/- 305,102)
test tests::bungee ... bench: 2,504,040 ns/iter (+/- 60,773)
test tests::lucky5 ... bench: 45,386 ns/iter (+/- 9,554)
test tests::velocity ... bench: 7,023,560 ns/iter (+/- 58,624)
```
Lucky5 is orders of magnitude faster? And the bungee writer now surpasses velocity's old writer?
The array version is found in the `arrays` branch.