Skip to content

Add prefixOffset option #97

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

Merged
merged 2 commits into from
Jan 25, 2021
Merged

Add prefixOffset option #97

merged 2 commits into from
Jan 25, 2021

Conversation

arj03
Copy link
Member

@arj03 arj03 commented Jan 25, 2021

Makes it possible specifiy where in the target the prefix buffer should be constructed from.

Some motivation here, it will make some certain prefix indexes much faster.

@arj03
Copy link
Member Author

arj03 commented Jan 25, 2021

Odd, that test failure is unrelated to this change.

@arj03
Copy link
Member Author

arj03 commented Jan 25, 2021

Seems to be a problem in the test runner...

@staltz
Copy link
Member

staltz commented Jan 25, 2021

Yeah, seems unrelated. But here's a proposed fix:

-  state = validate.appendNew(state, null, keys, msg1, Date.now() + 3000)
-  state = validate.appendNew(state, null, keys, msg2, Date.now() + 2000)
-  state = validate.appendNew(state, null, keys, msg3, Date.now() + 1000)
+  const now = Date.now()
+  state = validate.appendNew(state, null, keys, msg1, now + 3000)
+  state = validate.appendNew(state, null, keys, msg2, now + 2000)
+  state = validate.appendNew(state, null, keys, msg3, now + 1000)

@arj03
Copy link
Member Author

arj03 commented Jan 25, 2021

I think the problem is bigger than that. Working on a fix in a different branch

@github-actions
Copy link

Benchmark results

Part Duration
Load core indexes 6ms
Query 1 big index (1st run) 1078ms
Query 1 big index (2nd run) 358ms
Create an index twice concurrently 364ms
Query 3 indexes (1st run) 590ms
Query 3 indexes (2nd run) 334ms
Paginate 1 big index 285ms
Query a prefix map (1st run) 297ms
Query a prefix map (2nd run) 6ms

@arj03
Copy link
Member Author

arj03 commented Jan 25, 2021

I'll do a PR against db2 when this is ready for key & others that might have use of this :)

Copy link
Member

@staltz staltz left a comment

Choose a reason for hiding this comment

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

Thanks!

@arj03 arj03 merged commit e7fb193 into master Jan 25, 2021
@arj03 arj03 deleted the prefix-offset branch January 25, 2021 13:26
@github-actions
Copy link

Benchmark results

Part Duration
Load core indexes 8ms
Query 1 big index (1st run) 1016ms
Query 1 big index (2nd run) 321ms
Create an index twice concurrently 371ms
Query 3 indexes (1st run) 629ms
Query 3 indexes (2nd run) 275ms
Paginate 1 big index 302ms
Query a prefix map (1st run) 286ms
Query a prefix map (2nd run) 6ms

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