Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Cache locality and speed

Aperta
#7,453 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
cpp, wasm

Direzione di ricerca

Inizia esaminando OptimizeInstructions e il percorso --roundtrip, quindi riproduci il confronto riportato del testcase Kotlin tra esecuzioni ripetute di -O3 con e senza roundtrip. Un risultato utile stabilirebbe se il riutilizzo delle istruzioni o un approccio di defrag automatico migliora il tempo di ottimizzazione senza dipendere dal passaggio roundtrip.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Talking with @tlively , we realized that --roundtrip will restructure code back into a cache-friendly form, since it serializes it and then reads it, and when we read it, we allocate adjacent instructions contiguously in an arena. Imagine we begin with unoptimized code, then optimizations quickly add pointers to arbitrary places in memory, but doing a --roundtrip can "fix" that, and might be worth it if we run more optimizations afterwards.

To measure this, I took a large unoptimized Kotlin testcase I have. -O3 takes 50 seconds, a second -O3 after it takes 25 seconds (it makes sense it would be faster, since after the first cycle, there is a lot less code). Adding a --roundtrip between the two adds 2 seconds for the roundtrip itself, but makes the total time 2 seconds faster. So ignoring the roundtrip's time, we gain 4 seconds on the second -O3, which is something like 15% faster.

Perhaps we should try to reuse instructions when rewriting more - we do that in OptimizeInstructions in some places, but it does make the code more complex. Perhaps helper utilities can do that in nice ways though.

In theory we could consider doing some reordering ("defrag") that is more efficient that roundtrip, automatically after enough passes have been run.

cc #4165

Lingua principale
WebAssembly
Stelle
8.7k
Fork
893
Merge medio
1g 11h
PR unite (30g)
74

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di WebAssembly/binaryen

Tutte le issue di WebAssembly/binaryen

Issue simili

Altre issue su Compilers

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.