perf(search): cache the tantivy IndexReader on RoomIndex#6707
Merged
stefanceriu merged 1 commit intoJul 2, 2026
Conversation
Signed-off-by: Procr <193802945+procr1337@users.noreply.github.com>
e0bf201 to
0346d34
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6707 +/- ##
=======================================
Coverage ? 89.95%
=======================================
Files ? 397
Lines ? 110660
Branches ? 110660
=======================================
Hits ? 99539
Misses ? 7351
Partials ? 3770 ☔ View full report in Codecov by Harness. |
Contributor
Author
|
@stefanceriu the codecov report seems broken, it doesn't show any info about covered or uncovered lines. It just says "No Files covered by tests were changed" |
stefanceriu
approved these changes
Jul 1, 2026
stefanceriu
left a comment
Member
There was a problem hiding this comment.
Looks great to me, thank you for taking the time!
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.
This is a fix for a performance issue we encountered when backfilling events into the search engine in a real matrix room with 10k+ messages. The issue is that
RoomIndex::bulk_executeperforms reading operations between each write (e.g. inside::add(), it calls::contains(), which transitively calls::get_reader()). The reader creation would take about ~30ms in this case per inserted event, which is highly prohibitive.