meilisearch / meilisearch/grenad
Speed-up the Sorter
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 26
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
The Sorter is doing a lot of operations to ensure the values are merged in the correct order.
I thought about a simple way to speed the sort operation a little bit: store the first byte(s) of the key in the pointer of the EntryBound itself, this way we will reduce the data fetching from the other side of the in-memory buffer. We could use an equivalent of the C bitfields.
We can then conditionally fetch the key at the other side of the buffer only if both first bytes of the two compared keys are equal. We will need to use the <[EntryBound]>::sort_by variant and no more the <EntryBound>::sort_by_key one.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/sorter.rs, especially EntryBound::sort_by_key around lines 269-280 and EntryBound around lines 332-338. Compare the sort_by and sort_by_key paths and determine how the key prefix can be retained in EntryBound. Done means comparisons avoid fetching the full key unless the stored prefixes match.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100