Performance improvement in `SimHashIterator`
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 38/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- rust
- Ambito
- performance
Direzione di ricerca
Inizia individuando SimHashIterator, BitChunks e SIM_BUCKET_SIZE nel repository, quindi leggi come vengono attualmente formati i bucket. Analizza come BitChunks possa saltare gli intervalli di zeri e come verrebbe gestito un bucket che si estende su più chunk. Il lavoro è completato quando si riduce la mescolanza degli intervalli vuoti senza modificare i risultati dei bucket SimHash.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The current SimHashIterator works by finding the most significant active bit, and then calculating the number of SimHash buckets that will exist from that bit to the end of the filter. This means we are iterating (most_significant_bit / SIM_BUCKET_SIZE) + SIM_BUCKETS buckets.
The problem here is that in the higher order bits the sparsity is very high, meaning that there will potentially be many buckets where the values we're mixing into our SimHashes will just be zeros, and given any value XOR 0 is just that value this is wasted computation.
We could move to use the BitChunks iterators which batch up our chunks into a u64 and an index of that block of bits, skipping ranges full of zeros. This will introduce issues where if our SimHash bucket straddles multiple BitChunks, which can be solved by peeking the next chunk, making sure that the index is contiguous with our current chunk.
Right now SIM_BUCKET_SIZE is always 6 bits but if we allowed fully arbitrary SimHash bucket sizes this could get slightly gnarly because we'd need to be able to peek an arbitrary number of BitChunks ahead of the current position.
The following is a line chart plot of the proportion of empty bit_ranges mixed into the SimHashes using pseudorandomly generated geofilters with 0..100_000 items added to them.
The ratio reduces very sharply after a couple of inserts but remains relatively high since newly added items have some chance of landing in a very significant bucket which introduces a load of zero gaps before the next one bit.
- Lingua principale
- Rust
- Stelle
- 134
- Fork
- 24
- Merge medio
- 16h 27m
- PR unite (30g)
- 11
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di github/rust-gems
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
-
`bpe` Python Bindings? Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Tutte le issue di github/rust-gems
Issue simili
-
has_tail_capacity wraps and get_writable_raw_unchecked commits raw_len before the bounds check Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
stratum-mining/stratum#2404 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
Axis areas are always keyboard-focusable (Sense::drag), even with allow_axis_zoom_drag(false) Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
bug team:backend track:services-maintenance
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
cowprotocol/services#4950 ·