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

Optimize for non-int and non-dup-sort types of databases using features #170

Merged
merged 2 commits into from
Nov 13, 2019

Conversation

victorporof
Copy link
Contributor

@victorporof victorporof commented Nov 9, 2019

Signed-off-by: Victor Porof [email protected]

Our current safe mode database implementation uses a BTreeMap<Key, BTreeSet<Value>> to represent its data. This makes it so that we support the DUP_SORT database flag inherited from LMDB, which in turn allows multi-stores.

We don't use this in CRLite, so we'd incur a bit of overhead caused by the multiple levels of indirection. Making this distinction using the type system would either:

  • make our already convoluted generics soup even more soup-y, or
  • incur conditionals overhead when matching enums (e.g. Store(Single | Multi)), or
  • require dynamic dispatch (for example, for a boxed Store trait)

Simplest way around this is just using features.

@victorporof victorporof requested a review from ncloudioj November 9, 2019 13:02
@victorporof victorporof force-pushed the db-type-features branch 3 times, most recently from 97d1fbc to 54f7123 Compare November 9, 2019 16:22
@victorporof victorporof force-pushed the db-type-features branch 2 times, most recently from 2a6b7ae to f34bb6e Compare November 12, 2019 09:58
Copy link
Member

@ncloudioj ncloudioj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this setup!

@victorporof victorporof changed the base branch from clippy-to-string to safe-mode November 13, 2019 06:29
@victorporof victorporof merged commit 25c357a into safe-mode Nov 13, 2019
@victorporof victorporof deleted the db-type-features branch November 13, 2019 06:35
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.

2 participants