Skip to content

A room catches up in minutes instead of hours on a big project: two indexes - #121

Merged
ensapra merged 2 commits into
n-delic:mainfrom
tiredunc:perf/index-functions-by-address
Oct 26, 2026
Merged

ensapra merged 2 commits into
n-delic:mainfrom
tiredunc:perf/index-functions-by-address

Conversation

@tiredunc

Copy link
Copy Markdown

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.

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.
@github-actions github-actions Bot added the enhancement New feature or request label Oct 26, 2026

@ensapra ensapra left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good, thanks for this!

@ensapra
ensapra merged commit 841767d into n-delic:main Oct 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants