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

Refactor db interface #691

Merged
merged 3 commits into from
Aug 28, 2024
Merged

Refactor db interface #691

merged 3 commits into from
Aug 28, 2024

Conversation

jonasseglare
Copy link
Collaborator

This PR mainly refactors the code in src/datahike/db.cljc and src/datahike/db/interface.cljc so that datom filtering and evaluation of current datoms from historical ones is moved into the single function datahike.db/post-process-datoms. This makes the code easier to reason about and deduplicates some calls. These changes will also make it easier to move forward with the code in the PR #674 .

I had to introduce a record SearchContext to make it fast enough and resort to Java interop syntax to access fields. Otherwise, it is too slow.

I measured the performance change and this code takes rougly 2% less time in my benchmark which is a small improvement:

TARGET                          ABS TIME (s)   REL TIME
Official Datahike                     49.765       100%
Refactor db interface                 48.666        98%

Copy link
Member

@whilo whilo left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks!

@whilo whilo merged commit 099d8ba into main Aug 28, 2024
7 of 8 checks passed
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