Consider removing un-needed memory operation shims
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 50/100
- Tipo de issue
- Refactorización
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- c, wasm
- Área
- build-system, performance
Línea de trabajo
Empieza con src/mem.c y mem.h; después, audita los sitios de llamada actuales en input_init y buf_put frente a la compilación con -O2 -mbulk-memory --gc-sections. Compara los tamaños de clayterm.wasm sin comprimir y comprimido con gzip con main usando wc -c y gzip -c | wc -c. Se considera terminado cuando cada shim tiene una decisión documentada de conservarlo o eliminarlo, respaldada por la compilación y las mediciones de tamaño.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 42
- Forks
- 2
- Merge medio
- 2 d 5 h
- PR fusionados (30 d)
- 12
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de bombshell-dev/tty
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
bombshell-dev/tty#61 · 1 reacción ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
bombshell-dev/tty#129 ·
-
question
Dificultad 5/5 Más de una semana Aptitud para principiantes 38/100
bombshell-dev/tty#112 ·
-
enhancement high priority
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
bombshell-dev/tty#83 · 2 comentarios ·
-
enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
bombshell-dev/tty#82 ·
Todos los issues de bombshell-dev/tty
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
bug v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
modelcontextprotocol/inspector#2458 · 1 comentario ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
carbon-design-system/ibm-products#9907 ·