Repository navigation
A room catches up in minutes instead of hours on a big project: two indexes - #121
Merged
Merged
Conversation
The host sends every note it has, and each is saved only when the function doesn't have it already. notes had no index, so every check read all the notes saved so far (3 ms each at 7,000 notes). An index on (project_id, function_id) makes it 0.014 ms.
ensapra
approved these changes
Oct 26, 2026
ensapra
left a comment
Collaborator
There was a problem hiding this comment.
Looks good, thanks for this!
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.
Joining a room on a big project sat on "Getting the host's work" for hours. The room looks a function up by its address for every match, best attempt and note the host sends, and checks each note against the notes already saved. Neither had an index, so each look-up scanned the whole table. functions by address: 89 ms for 18,800 functions, now 0.02 ms (each row carries the assembly, 86 MB in all). notes: 3.2 ms with 7,000 notes, now 0.014 ms (the host sends 60,000 notes, so that was minutes). Both indexes build in well under a second the first time the app opens the database, and an older version just ignores them. Tested: two new tests check the look-ups use the indexes; full suite passes except two tests that also fail on main (usage-limit time parsing, tray GTK check). Measured on a PS2 project with 18,800 functions.