Performance optimization opportunity: combinator.c file I/O bottleneck
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 42/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- c
- Ambito
- performance
Direzione di ricerca
The hot spot is the loop in combinator.c where rewind(fd2) runs for each line of file1 (around line 217), so file2 is re-read on every outer iteration. Build the tool and time it on a generated 10,000 × 1,000 line input to reproduce the slowdown. Done means file2 is read once into memory and the output is byte-identical to the current version on the same inputs. The proposed combinator_optimized.c is not in this repo, so check the thread for its status before reusing it.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The current combinator.c implementation has an O(n*m) file I/O bottleneck:
- File2 is completely re-read for every line in file1 (line 217:
rewind(fd2)) - For a 10,000 × 1,000 line combination, this results in 10 million file reads instead of 1
- Performance degrades exponentially as file1 size increases
Performance Impact
Stress Test Results (10,000 × 1,000 lines = 10M combinations):
- Current implementation: Timeout (>60 seconds)
- Optimized implementation: <1 second
- Speedup: >60x improvement
Memory usage remains similar (~33MB for both versions)
Proposed Solution
I've created combinator_optimized.c that implements:
- File2 Memory Caching: Load entire file2 once into memory, eliminating all rewind operations
- Enhanced Error Handling: Added malloc() null pointer checks to prevent segfaults
- Combined Line Processing: Single-pass carriage return stripping
- Improved Buffer Management: More efficient I/O batching
- Lingua principale
- C
- Stelle
- 1.6k
- Fork
- 421
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 hashcat/hashcat-utils
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
hashcat/hashcat-utils#104 · 7 commenti · 1 reazione ·
-
Link Type 1 UnsupportedAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 18/100
hashcat/hashcat-utils#92 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
hashcat/hashcat-utils#87 ·
-
BUG reportAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
hashcat/hashcat-utils#86 · 1 reazione ·
-
feature: multibyte cutbApertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
hashcat/hashcat-utils#83 ·
Tutte le issue di hashcat/hashcat-utils
Issue simili
-
bug intrinsic low priority wrong result
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
`table_create()` crashes when an `hccalloc()` for the option table failsForse già presa @marinelay l’ha presa oggi. Apertatype: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Outdated labels in Menu Item Visibility (`Show 'Quit RetroArch'` / `Show 'Restart RetroArch'`)Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
bug severity: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
AlessandroSangiuliano/Uros#950 ·