https://github.com/quark-zju/bvarint
Variable-Length Quantity encoding that preserves memcmp order.
https://github.com/quark-zju/bvarint
Last synced: 3 months ago
JSON representation
Variable-Length Quantity encoding that preserves memcmp order.
- Host: GitHub
- URL: https://github.com/quark-zju/bvarint
- Owner: quark-zju
- License: mit
- Created: 2020-08-29T01:18:07.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-29T02:04:05.000Z (over 4 years ago)
- Last Synced: 2025-01-08T08:45:52.446Z (5 months ago)
- Language: Rust
- Size: 2.93 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bvarint
A Better Varint encoding that preserves `memcmp` order.
Based on "A Better Varint..." slide from [D. Richard Hipp](https://en.wikipedia.org/wiki/D._Richard_Hipp)'s [talk](https://youtu.be/gpxnbly9bz4?t=2386):
> We use variable length integers.
>
> [snip: how traditional VLQ works]
>
> This was a mistake. If you need variable length integers, don't do them this way. Instead, do them like this where the first byte tells you the magnitude of the integer.
>
> This is very important for efficiency in parsing. The other thing is that you can actually compare two integers using `memcmp` without having to decode them.