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

Rewrite the encoding scheme for integers #8

Merged
merged 2 commits into from
Jan 28, 2024
Merged

Conversation

noib3
Copy link
Collaborator

@noib3 noib3 commented Jan 28, 2024

Rewrote the integer encoding/decoding logic. It now takes 1 byte to encode 0..63 and 2 to encode 64..2**15. Integers >= than 2**15 are always encoded with a prefix byte that represents their length.

# Before
serde_json | Replica: 596.94 KB
serde_json | Total insertions: 6.62 MB
serde_json | Total deletions: 4.04 MB

bincode | Replica: 229.98 KB
bincode | Total insertions: 3.96 MB
bincode | Total deletions: 2.16 MB

zstd'd serde_json | Replica: 153.61 KB
zstd'd serde_json | Total insertions: 7.36 MB
zstd'd serde_json | Total deletions: 4.61 MB

zstd'd bincode | Replica: 128.68 KB
zstd'd bincode | Total insertions: 5.52 MB
zstd'd bincode | Total deletions: 2.82 MB
# After
serde_json | Replica: 553.96 KB
serde_json | Total insertions: 5.98 MB
serde_json | Total deletions: 3.78 MB

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

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

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

@noib3 noib3 marked this pull request as ready for review January 28, 2024 19:56
@noib3 noib3 changed the title Rewrite encoding and decoding of integers Rewrite the encoding scheme for integers Jan 28, 2024
@noib3 noib3 merged commit 2bcfde2 into main Jan 28, 2024
5 checks passed
@noib3 noib3 deleted the better-int-encoding branch January 28, 2024 19:57
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