Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encode integers using LEB128 #10

Merged
merged 2 commits into from
Jul 5, 2024
Merged

Encode integers using LEB128 #10

merged 2 commits into from
Jul 5, 2024

Conversation

noib3
Copy link
Collaborator

@noib3 noib3 commented Jul 4, 2024

Using LEB128 seems to bring a 0-10% reduction in message size compared to our own variable-length integer encoding algorithm.

Before:

bincode | Replica: 163.05 KB
bincode | Total insertions: 3.24 MB
bincode | Total deletions: 1.81 MB

serde_json | Replica: 553.96 KB
serde_json | Total insertions: 5.98 MB
serde_json | Total deletions: 3.78 MB

zstd'd bincode | Replica: 134.37 KB
zstd'd bincode | Total insertions: 4.81 MB
zstd'd bincode | Total deletions: 2.47 MB

zstd'd serde_json | Replica: 156.90 KB
zstd'd serde_json | Total insertions: 7.08 MB
zstd'd serde_json | Total deletions: 4.42 MB

After:

bincode | Replica: 160.76 KB
bincode | Total insertions: 3.14 MB
bincode | Total deletions: 1.74 MB

serde_json | Replica: 494.34 KB
serde_json | Total insertions: 5.39 MB
serde_json | Total deletions: 3.43 MB

zstd'd bincode | Replica: 133.02 KB
zstd'd bincode | Total insertions: 4.71 MB
zstd'd bincode | Total deletions: 2.40 MB

zstd'd serde_json | Replica: 146.91 KB
zstd'd serde_json | Total insertions: 6.63 MB
zstd'd serde_json | Total deletions: 4.09 MB

@noib3 noib3 marked this pull request as ready for review July 5, 2024 12:57
@noib3 noib3 merged commit 264239e into main Jul 5, 2024
5 checks passed
@noib3 noib3 deleted the varint-leb128 branch July 5, 2024 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant