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

Add script with a bunch of common queries #136

Merged
merged 9 commits into from Jan 23, 2021
Merged

Add script with a bunch of common queries #136

merged 9 commits into from Jan 23, 2021

Conversation

arj03
Copy link
Member

@arj03 arj03 commented Jan 21, 2021

I noticed that I didn't have a very good idea of how common queries are running. This gives us a better idea. Might be good to run in the CI thingy. But for now I'll just dump them here.

Output

running: key initial
query: 199.9ms
running: key 2
query: 25.106ms
running: key again
query: 22.5ms
running: latest root posts
query: 125.503ms
running: latest posts
query: 233.988ms
running: votes initial
query: 60.99ms
running: votes 2
query: 16.416ms
running: votes again
query: 7.335ms
running: author posts
query: 309.867ms
running: author posts again
query: 65.469ms

@github-actions
Copy link

Benchmark results

Part Duration
Migration (using ssb-db) 8803ms
Migration (alone) 4028ms
Initial indexing 2998ms

@staltz
Copy link
Member

staltz commented Jan 21, 2021

Could we merge this PR only when it's running against ssb-fixtures? This way we can objectively compare numbers across computers, and we don't need to depend on personal data (and their msg.keys), also making it better for other future contributors to run them.

@arj03 arj03 marked this pull request as draft January 21, 2021 19:46
@arj03
Copy link
Member Author

arj03 commented Jan 21, 2021

Yes very good idea. Was mostly interested in getting in some good queries that are used a lot in apps.

@staltz
Copy link
Member

staltz commented Jan 21, 2021

Or actually, how about folding these into the benchmark/index.js? After all, the goal of these scripts is to check the perf. Then it's easier, just add new tests with these queries

@arj03
Copy link
Member Author

arj03 commented Jan 21, 2021

Agree, that's what I meant with the: "Might be good to run in the CI thingy" :-) I'm using this now mostly to test the optimization for prefixes. Once that is done I'll make a proper PR. This was mostly meant as an open invitation if you have any queries from your threads testing but you can of course always add them afterwards :)

@github-actions
Copy link

Benchmark results

Part Duration
Migration (using ssb-db) 7243ms
Migration (alone) 3546ms
Initial indexing 2447ms

@github-actions
Copy link

Benchmark results

Part Duration
Migration (using ssb-db) 7156ms
Migration (alone) 3557ms
Initial indexing 2465ms

@staltz staltz marked this pull request as ready for review January 23, 2021 09:32

'votes one': [and(votesFor(KEY1))],

'votes again': [and(votesFor(KEY1))],
Copy link
Member

Choose a reason for hiding this comment

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

@arj03 see above, can we delete one of these? Running it three times doesn't seem necessary

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes

@staltz
Copy link
Member

staltz commented Jan 23, 2021

@arj03 I pushed some commits that move these queries into benchmark/index.js

@github-actions
Copy link

Benchmark results

Part Duration
Migration (using ssb-db) 7994ms
Migration (alone) 3824ms
Initial indexing 2731ms
key one initial 818ms
key two 4ms
key one again 10ms
latest root posts 531ms
latest posts 16ms
votes one initial 525ms
votes one 5ms
votes again 0ms
hasRoot 373ms
hasRoot again 0ms
author one posts 324ms
author two posts 53ms

@ssbc ssbc deleted a comment from github-actions bot Jan 23, 2021
@arj03
Copy link
Member Author

arj03 commented Jan 23, 2021

The idea with the second run is that we test not having to load the index from disc. So it needs to be a another key otherwise we will test your weakmap cache instead.

@arj03
Copy link
Member Author

arj03 commented Jan 23, 2021

Other than that it's really good to see these queries here in the CI

@staltz
Copy link
Member

staltz commented Jan 23, 2021

Alright, LGTM. How about you review and merge? (note that perf.js was deleted)

@github-actions
Copy link

Benchmark results

Part Duration
Migration (using ssb-db) 6334ms
Migration (alone) 3139ms
Initial indexing 2038ms
key one initial 479ms
key two 6ms
key one again 5ms
latest root posts 446ms
latest posts 6ms
votes one initial 441ms
votes again 4ms
hasRoot 314ms
hasRoot again 0ms
author one posts 254ms
author two posts 43ms

@arj03 arj03 merged commit 8b7482c into master Jan 23, 2021
@arj03 arj03 deleted the test-performance branch January 23, 2021 10:18
@github-actions
Copy link

Benchmark results

Part Duration
Migration (using ssb-db) 6582ms
Migration (alone) 3104ms
Initial indexing 2429ms
key one initial 694ms
key two 7ms
key one again 4ms
latest root posts 449ms
latest posts 15ms
votes one initial 435ms
votes again 4ms
hasRoot 312ms
hasRoot again 1ms
author one posts 272ms
author two posts 52ms

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.

None yet

2 participants