Measure the feed query at the size a follow list actually is - #78
Merged
Conversation
The bench has always reported the feed shape over twenty authors, and at twenty authors it is free. A merged query opens one cursor per author and picks the newest across every live stream once per returned event, so its cost is set by how many people the reader follows, not by how many notes come back. Twenty is not a follow list, and measuring there made the hottest path in a client look like it cost nothing. Two shapes added on the same store, and one knob: BENCH_AUTHORS sizes the store's author spread and the wide feed's follow set together, so every author that shape names has posted and no stream in the merge dies early. It defaults to 100, which is what the three existing shapes have always been measured against, so their numbers stay comparable release to release. BENCH_FEED_LIMIT is the depth, because that is the number a reader raises by scrolling and the merge pays the whole author set again for every extra note. "same feed by id" answers the same question the other way: name the ids that arrived and read each directly. It is the comparison that matters for anything refreshing a feed it already holds. On this machine, ReleaseFast, best of 50 and the lowest of repeated runs, 2049 authors over 210k events: limit 60 : 1.46 ms limit 300 : 3.46 ms limit 660 : 6.32 ms limit 1200 : 10.80 ms which is 0.97 ms of fixed cost plus 8.2 us per returned note, both proportional to the author count. The same eight notes named by id: 14 us.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bench has always reported the feed shape over twenty authors, and at twenty authors it is free. A merged query opens one cursor per author and picks the newest across every live stream once per returned event, so its cost is set by how many people the reader follows, not by how many notes come back. Twenty is not a follow list, and measuring there made the hottest path in a client look like it costs nothing.
Two shapes on the same store, and one knob.
BENCH_AUTHORSsizes the store's author spread and the wide feed's follow set together, so every author that shape names has posted and no stream in the merge dies early. It defaults to 100, which is what the three existing shapes have always been measured against, so their numbers stay comparable release to release.BENCH_FEED_LIMITis the depth, because that is the number a reader raises by scrolling, and the merge pays the whole author set again for every extra note.same feed by idanswers the same question the other way: name the ids that arrived and read each directly. That is the comparison that matters for anything refreshing a feed it already holds.On this machine, ReleaseFast, best of 50 and the lowest of repeated runs, 2049 authors over 210k events:
BENCH_FEED_LIMITThat is 0.97 ms of fixed cost plus 8.2 us per returned note, both proportional to the author count. The same eight notes named by id: 14 us.
Default run is unchanged:
Bench only. No library code changed, all 163 tests pass.