Consider removing un-needed memory operation shims
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 50/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- c, wasm
- Ambito
- build-system, performance
Direzione di ricerca
Inizia da src/mem.c e mem.h, quindi verifica i call site attuali in input_init e buf_put rispetto alla build con -O2 -mbulk-memory --gc-sections. Confronta le dimensioni di clayterm.wasm grezzo e compresso con gzip con main usando wc -c e gzip -c | wc -c. Il lavoro è completato quando per ogni shim è documentata una decisione di mantenerlo o rimuoverlo, supportata dalla build e dalle misurazioni delle dimensioni.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
src/mem.c currently provides memcpy, memset, strlen, and align8 as freestanding-wasm shims, and PR #32 proposes adding a memmove shim alongside them. Investigation of the linked clayterm.wasm shows that none of these functions survive into the final binary under the current -O2 -mbulk-memory --gc-sections build:
- A non-stripped build links cleanly with zero
memcpy/memset/strlen/align8symbols in the output. input_init— the heaviest caller, containing the trie-building loop over the static cap tables — compiles to zero call instructions. LLVM inlines every constant-sizememset/memcpy, unrolls the trie loop, and constant-foldsstrlenon the literal sequences.buf_put's variable-lengthmemcpylowers directly to amemory.copyinstruction thanks to-mbulk-memory.
In other words, the shims exist purely as a safety net for code the optimizer fails to lower. And if the optimizer fails to lower it, then that is something that should be surfaced, not silently cause our performance to degrade.
Possible Approach
Audit each shim against current call sites and decide case-by-case:
align8— trivial(n + 7) & ~7. Best candidate for a free win: move intomem.hasstatic inlineand drop the definition frommem.c. Before doing so, build and compare raw + gzipped bundle size againstmainto confirm the inline expansion does not regress size (it shouldn't — every call site is already inlined — but it is worth measuring rather than assuming).memset/memcpy— every current call is constant-size or variable-length-with--mbulk-memory-lowering, so both are dead in the linked binary. Keep as a safety net or drop entirely; if dropped, document the requirement that contributors avoid call patterns the optimizer cannot lower.strlen— only foldable because the cap tables are statically initialized literals. A future call on a runtime string (e.g.buf_str(b, user_input)) would re-introduce the link dependency. Lowest-risk shim to keep.memmove(PR #32) — reconsider in light of the above. If we keep the others as defensive shims, merging this one is consistent; if we trim, this one should not land without a real call site.
Decisions should be backed by before/after wc -c and gzip -c | wc -c on clayterm.wasm.
- Lingua principale
- TypeScript
- Stelle
- 42
- Fork
- 2
- Merge medio
- 2g 5h
- PR unite (30g)
- 12
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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 bombshell-dev/tty
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
bombshell-dev/tty#61 · 1 reazione ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
bombshell-dev/tty#129 ·
-
question
Difficoltà 5/5 Più di una settimana Idoneità per principianti 38/100
bombshell-dev/tty#112 ·
-
enhancement high priority
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
bombshell-dev/tty#83 · 2 commenti ·
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
bombshell-dev/tty#82 ·
Tutte le issue di bombshell-dev/tty
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
safetrustcr/dApp-SafeTrust#426 ·
-
area:workflow bug ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
fil-donadoni/tolaria#4409 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Fission-AI/OpenSpec#1960 ·
-
Add dependabot Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
corsairdev/corsair#1764 ·