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

perf(db): compact felts / bincode bad #403

Open
1 task done
Tracked by #419
cchudant opened this issue Dec 2, 2024 · 0 comments
Open
1 task done
Tracked by #419

perf(db): compact felts / bincode bad #403

cchudant opened this issue Dec 2, 2024 · 0 comments
Labels
db-migration Requires database schema changes or migration research Research and exploration required before implementation

Comments

@cchudant
Copy link
Member

cchudant commented Dec 2, 2024

Is there an existing issue?

  • I have searched the existing issues

Motivation

From @shamsasari's comment on #372:

bincode prepends a 8-byte length value, so it outputs 40 bytes instead of 32. I would suggest we use to_bytes_be directly.

Request

we use bincode a lot where we shouldn't really do it, especially for db keys.
that's a lot of wasted bytes in the db - also, in addition, for felts that are short (0x1...) we could use the 4/5 leading unused bytes to mark the length of the felt, leading to very short keys for a lot

We could also do that for values

Solution

We already tried implementing that upstream on the felt type with @jbcaron, i think, but the PR hasnt been merged: starknet-io/types-rs#76

We may want to bring it back

Are you willing to help with this request?

Maybe (please elaborate above)

@Trantorian1 Trantorian1 changed the title db size: compact felts / bincode bad perf(db): compact felts / bincode bad Dec 10, 2024
@Trantorian1 Trantorian1 added the research Research and exploration required before implementation label Dec 12, 2024
@Trantorian1 Trantorian1 moved this to Ready in Madara Dec 12, 2024
@Trantorian1 Trantorian1 added the db-migration Requires database schema changes or migration label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
db-migration Requires database schema changes or migration research Research and exploration required before implementation
Projects
Status: Ready
Development

No branches or pull requests

2 participants