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

Use fixed-sized types in redb to avoid storing lengths #417

Closed
casey opened this issue Sep 1, 2022 · 1 comment · Fixed by #516
Closed

Use fixed-sized types in redb to avoid storing lengths #417

casey opened this issue Sep 1, 2022 · 1 comment · Fixed by #516

Comments

@casey
Copy link
Collaborator

casey commented Sep 1, 2022

I think if we use fixed-size types, we'll save a u64 or u32 length. @cberner is this right?

So we can change our table definitions to:

const HEIGHT_TO_HASH: TableDefinition<u64, [u8; 32]> = TableDefinition::new("HEIGHT_TO_HASH");

const OUTPOINT_TO_ORDINAL_RANGES: TableDefinition<[u8; 36], [u8]> =
  TableDefinition::new("OUTPOINT_TO_ORDINAL_RANGES");

const OUTPOINT_TO_TXID: TableDefinition<[u8; 36], [u8; 32]> = TableDefinition::new("OUTPOINT_TO_TXID");
@casey casey changed the title Use fixed-sized types in redb to avoid storing length Use fixed-sized types in redb to avoid storing lengths Sep 1, 2022
@cberner
Copy link
Contributor

cberner commented Sep 1, 2022

Yep! You'll save a u32 length for every key and/or value

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 a pull request may close this issue.

2 participants