Consider removing un-needed memory operation shims
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 50/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- c, wasm
- Lĩnh vực
- build-system, performance
Hướng nghiên cứu
Bắt đầu với src/mem.c và mem.h, sau đó kiểm tra các call site hiện tại trong input_init và buf_put so với bản build bằng -O2 -mbulk-memory --gc-sections. So sánh kích thước clayterm.wasm thô và được nén bằng gzip với main bằng wc -c và gzip -c | wc -c. Hoàn thành khi mỗi shim đều có quyết định được ghi lại về việc giữ lại hay loại bỏ, được bản build và các phép đo kích thước hỗ trợ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 42
- Fork
- 2
- Merge trung bình
- 21 giờ 40 phút
- Pull request đã merge (30 ngày)
- 9
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của bombshell-dev/tty
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
bombshell-dev/tty#61 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
bombshell-dev/tty#129 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
question
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
bombshell-dev/tty#112 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement high priority
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
bombshell-dev/tty#83 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
bombshell-dev/tty#82 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của bombshell-dev/tty
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
external-issue to-triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
diegosouzapw/OmniRoute#15401 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
code-yeongyu/oh-my-openagent#9454 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
smart-village-solutions/sva-studio#1654 ·
Maintainer thường phản hồi trong vòng 1 ngày