Skip to content

Instantly share code, notes, and snippets.

@roninjin10
Last active June 21, 2025 04:29
Show Gist options
  • Save roninjin10/1af4c475638b2066d1549be74dacae01 to your computer and use it in GitHub Desktop.
Save roninjin10/1af4c475638b2066d1549be74dacae01 to your computer and use it in GitHub Desktop.
Tevm wasm report
=== WASM Size Analysis Tool ===
## File Size Comparison
Debug build: 1,451,592 bytes (1.38 MB)
Stripped build: 136,695 bytes (133.49 KB)
Debug overhead: 1,314,897 bytes (1.25 MB) (90.6% of debug build)
## Detailed Analysis of Stripped Build
### Section Breakdown
Code 118,373 bytes (115.60 KB) ( 86.6%)
Data 17,299 bytes (16.89 KB) ( 12.7%)
Function 291 bytes (0.28 KB) ( 0.2%)
Elem 266 bytes (0.26 KB) ( 0.2%)
Type 186 bytes (0.18 KB) ( 0.1%)
Export 148 bytes (0.14 KB) ( 0.1%)
Import 77 bytes (0.08 KB) ( 0.1%)
Global 9 bytes (0.01 KB) ( 0.0%)
Table 7 bytes (0.01 KB) ( 0.0%)
Memory 3 bytes (0.00 KB) ( 0.0%)
Total: 136,659 bytes (133.46 KB)
Code + Data: 135,672 bytes (132.49 KB) (99.3%)
### Function Analysis
Total functions: 591
Top modules by function count:
core 587 functions ( 99.3%)
env 4 functions ( 0.7%)
## Optimization Insights
- Code size is over 100KB. Consider:
- Enabling link-time optimization (LTO)
- Using ReleaseSmall optimization mode
- Removing unused features or modules
- High function count (591). Consider:
- Checking for duplicate generic instantiations
- Combining similar small functions
- Using function deduplication
## Further Optimization Tools
1. wasm-opt -Oz input.wasm -o output.wasm # Binaryen size optimization
2. twiggy top input.wasm # Show largest code sections
3. wasm-decompile input.wasm # Analyze generated code
[wasm-opt is available - running size optimization test...]
## Zig Code Size Attribution (via twiggy)
### Largest Zig Functions by Size:
frame.contract.valid_jumpdest 22,404 bytes ( 1.54%)
execution.system.op_create 8,730 bytes ( 0.60%)
crypto.sha2.Sha2x32(.{ 1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225 },256).round 6,445 bytes ( 0.44%)
execution.arithmetic.op_mulmod 5,189 bytes ( 0.36%)
vm.create_contract_internal.create_contract_internal 4,862 bytes ( 0.33%)
execution.system.op_create2 3,595 bytes ( 0.25%)
vm.call_contract.call_contract 3,577 bytes ( 0.25%)
execution.system.op_call 2,722 bytes ( 0.19%)
crypto.keccak_p.KeccakF(1600).permuteR__anon_13370 2,233 bytes ( 0.15%)
execution.stack.make_push__struct_3281.push 2,222 bytes ( 0.15%)
execution.system.op_callcode 2,188 bytes ( 0.15%)
execution.stack.make_push__struct_3272.push 2,148 bytes ( 0.15%)
execution.stack.make_push__struct_3263.push 2,074 bytes ( 0.14%)
execution.arithmetic.op_smod 2,066 bytes ( 0.14%)
execution.stack.make_push__struct_3254.push 2,000 bytes ( 0.14%)
execution.system.op_delegatecall 1,964 bytes ( 0.14%)
execution.arithmetic.op_addmod 1,958 bytes ( 0.13%)
execution.stack.make_push__struct_3245.push 1,926 bytes ( 0.13%)
execution.stack.make_push__struct_3236.push 1,852 bytes ( 0.13%)
execution.arithmetic.op_sdiv 1,808 bytes ( 0.12%)
execution.arithmetic.op_mod 1,802 bytes ( 0.12%)
execution.stack.make_push__struct_3227.push 1,778 bytes ( 0.12%)
execution.memory.op_mcopy 1,775 bytes ( 0.12%)
execution.log.make_log__struct_3675.log 1,754 bytes ( 0.12%)
frame.contract.mark_storage_slot_warm 1,713 bytes ( 0.12%)
execution.stack.make_push__struct_3218.push 1,704 bytes ( 0.12%)
execution.stack.make_push__struct_3209.push 1,630 bytes ( 0.11%)
execution.log.make_log__struct_3665.log 1,620 bytes ( 0.11%)
execution.crypto.op_sha3 1,573 bytes ( 0.11%)
execution.stack.make_push__struct_3200.push 1,556 bytes ( 0.11%)
### Size by Module:
execution 114,012 bytes ( 62.5%)
frame 24,556 bytes ( 13.5%)
crypto 10,467 bytes ( 5.7%)
hash_map 10,237 bytes ( 5.6%)
vm 9,366 bytes ( 5.1%)
main_c 3,928 bytes ( 2.2%)
2,452 bytes ( 1.3%)
precompiles 1,684 bytes ( 0.9%)
array_list 1,261 bytes ( 0.7%)
heap 1,041 bytes ( 0.6%)
access_list 930 bytes ( 0.5%)
rlp 696 bytes ( 0.4%)
hash 575 bytes ( 0.3%)
memory 412 bytes ( 0.2%)
blob 315 bytes ( 0.2%)
Total Zig code: 182,505 bytes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment