A Wasm size profiler for MoonBit — section breakdown, function ranking, call graph and retained-size analysis
moon add BigSaltyMan/moonsize@0.5.1moon build --target native --release
./_build/native/release/build/cmd/main/main.exe app.wasmmoonsize app.wasm --data-segments --top 20
moonsize app.wasm --data-json new-data.json
moonsize app.wasm --html new-report.html --data-json new-data.jsonmoonsize app.wasm --find-data "assets/logo" --top 20
moonsize app.wasm --find-data "assets/logo" --find-data-json new-search.json
moonsize app.wasm --find-data-hex 00FF00 --find-data-json new-hex-search.json --top 1moonsize app.wasm --find-data "assets/logo"
moonsize app.wasm --data-preview 1 --data-offset 8 --data-limit 64
moonsize app.wasm --data-preview 1 --data-preview-json new-preview.json
moonsize after.wasm --data-preview 2 --data-offset 8 --data-limit 32 \
--baseline before.wasm --baseline-data-preview 1 --baseline-data-offset 4 \
--data-preview-json new-window-diff.jsonmoonsize app.wasm --compare-dependencies 12 47 --top 20
moonsize app.wasm --compare-dependencies 12 47 --compare-dependencies-json new-overlap.json --top 1moonsize app.wasm --path-between 12 47
moonsize app.wasm --path-between 12 47 --path-between-json new-path.json --strictmoonsize app.wasm --dependents 12 --top 20
moonsize app.wasm --dependents 12 --dependents-json new-dependents.json --top 1
moonsize app.wasm --dependents 12 --dependents-dot new-referrers.dot --top 1moonsize app.wasm --dependencies 12 --top 20
moonsize app.wasm --dependencies 12 --dependencies-json new-dependencies.json --top 1
moonsize app.wasm --dependencies 12 --dependencies-dot new-dependencies.dot --top 1moonsize app.wasm --cycles --cycle-witness --top 10
moonsize app.wasm --cycles-json new-witnesses.json --cycle-witness --top 1moonsize app.wasm --cycles --top 10
moonsize app.wasm --cycles-json new-cycles.json --top 1moonsize app.wasm --locate-range 40 32 --top 20
moonsize app.wasm --locate-range 40 32 --locate-range-json new-range.json --top 1moonsize app.wasm --locate-offset 31
moonsize app.wasm --locate-offset 31 --locate-offset-json new-location.jsonmoonsize app.wasm --find-opcode i32.const --top 20
moonsize app.wasm --find-opcode i32.const --find-opcode-json new-matches.json --top 1moonsize app.wasm --opcode-stats --top 20
moonsize app.wasm --opcode-stats-json new-opcodes.json --top 1
moonsize after.wasm --baseline before.wasm --diff-opcodes --top 20moonsize app.wasm --local-accesses 3 --top 20
moonsize app.wasm --local-accesses 3 --local-accesses-json new-accesses.json --top 1moonsize app.wasm --locals 3 --top 20
moonsize app.wasm --locals 3 --locals-json new-locals.json --top 1moonsize after.wasm --locals 5 --baseline before.wasm --baseline-locals 3 --top 20
moonsize after.wasm --locals 5 --baseline before.wasm --baseline-locals 3 --locals-json new-locals-diff.json --top 1moonsize app.wasm --calls 3 --top 20
moonsize app.wasm --calls 3 --calls-json new-calls.json --top 1moonsize after.wasm --baseline before.wasm --diff-functions-json new-function-diff.json --top 20
moonsize after.wasm --baseline before.wasm --diff-functions --diff-functions-json new-growth.json --max-size 5KBmoonsize app.wasm --summary-json new-summary.json --top 1 --retained --dead-code
moonsize app.wasm --summary-json new-strict-summary.json --strict --max-size 100KBmoonsize app.wasm --find-functions 'demo::sample' --top 20
moonsize app.wasm --find-functions 'classify' --find-functions-json new-search.jsonmoonsize app.wasm --instructions 3 --top 20
moonsize app.wasm --instructions 3 --instructions-json new-instructions.jsonmoonsize after.wasm --instructions 7 --baseline before.wasm --baseline-instructions 5 --top 20
moonsize after.wasm --instructions 7 --baseline before.wasm --baseline-instructions 5 --instructions-json new-instructions-diff.jsonmoonsize app.wasm --data-duplicates --top 20
moonsize app.wasm --data-duplicates-json new-data-duplicates.jsonnpm run devmoonsize --help
moonsize -h
moonsize --help-topic functions| Topic ID | Task | Existing guides |
|---|---|---|
| overview | Ordinary report, Top, HTML and summary JSON | HTML delivery, summary JSON |
| functions | Find an index, inspect instructions and model references | Search, instructions, callers |
| data | Data entries, duplicate payloads and comparisons | Data encodings and comparisons |
| interfaces | Imports/exports and their baseline comparisons | Imports, exports |
| metadata | Custom/name overhead, outer comparison and partial details | Metadata |
| baseline | File, function/package and selected-function comparisons | Function/package JSON, experiments |
| ci | Size gates, budget evidence and supported strict modes | Budgets |
moonsize -- --help
moonsize --top 1 --summary-json new-summary.json -- --app.wasmusage: moonsize <file.wasm> [--top <n>] [--retained] [--dead-code]
[--compress] [--strict] [--call-graph <path>] [--html <path>]
[--max-size <size>] [--baseline <path.wasm>] [--diff-functions]
[--diff-functions-json <new-path.json>]
[--summary-json <new-path.json>]
[--data-segments] [--diff-data] [--data-json <new-path.json>]
[--budget <config.json>] [--budget-json <path.json>] [--budget-md <path.md>]
[--experiment <report.html|report.json>] [--experiment-context <context.json>]
moonsize <file.wasm> --find-functions <query> [--top <n>] [--find-functions-json <new.json>]
moonsize <file.wasm> --instructions <n> [--top <n>] [--instructions-json <new.json>]
moonsize <after.wasm> --instructions <n> --baseline <before.wasm> --baseline-instructions <n> [--top <n>] [--instructions-json <new.json>]
moonsize <file.wasm> --data-duplicates [--top <n>] [--data-duplicates-json <new.json>]
moonsize <file.wasm> --imports [--top <n>] [--imports-json <new.json>]
moonsize <file.wasm> --baseline <before.wasm> --diff-imports [--top <n>] [--imports-json <new.json>]
moonsize <file.wasm> --metadata [--top <n>] [--metadata-json <new.json>]
moonsize <file.wasm> --duplicates [--top <n>] [--duplicates-json <new.json>]
moonsize <file.wasm> --entrypoints [--top <n>] [--entrypoints-json <new.json>] [--strict]
moonsize <file.wasm> --generics [--top <n>] [--generics-json <new.json>]
moonsize <file.wasm> --callers <n> [--top <n>] [--callers-json <new.json>] [--strict]
moonsize <file.wasm> --why-index <n> [--why-root <n>] [--why-json <path.json>] [--strict]
Report the section table of a WebAssembly binary, rank its heaviest
functions, roll the bytes up by module, and follow the call graph to
identify candidates for investigation.
--top <n> how many functions to rank (default 10)
--retained dominated function bytes in the current graph model
--dead-code functions no root can reach
--compress whole-file gzip and independent section gzip sizes
--data-segments append data-entry file bytes (payload-ranked by --top)
--data-json <path> enable details and write all entries to a new .json file
offset expressions are recorded, not evaluated
--diff-data compare exact payload content groups; requires --baseline
--data-json then writes the data comparison format
--strict refuse to report when the call graph is incomplete,
instead of reporting it with a warning
--call-graph <path> write a new .dot or .json call graph; refuses existing paths
--html <path> write a new self-contained HTML report; refuses existing paths
--data-segments or --data-json adds current-input data details
--max-size <size> fail with exit code 3 above this size, where size is
bytes or a KB/MB/GB count such as 10KB or 1.5MB
--budget <path> validated multi-metric byte budgets; growth needs --baseline
--budget-json <path> write budget JSON; requires --budget, refuses existing paths
--budget-md <path> write CI Markdown summary; requires --budget, refuses existing paths
--baseline <path> compare against another module and print the change;
--max-size then bounds the growth, not the file
--diff-functions append function and package changes; requires --baseline
--experiment <path> write measured before/after results; requires --baseline
refuses to overwrite an existing path
--experiment-context <path> attach declared build settings and validation
--locate-range <offset> <length> decompose file ownership; EOF empty allowed
--locate-range-json <path> complete ownership JSON to a new target
--locate-offset <n> locate one decimal file byte; EOF fails; no Top
--locate-decode opt-in whole target-body decoding to locals/instruction; requires query
--locate-offset-json <path> location to a new .json; requires query
--data-preview <index> bounded payload bytes (no Top); original entry index
--data-offset <n> payload byte offset, default 0; requires --data-preview
--data-limit <n> 1..4096 bytes, default 256; requires --data-preview
--baseline-data-preview <index> explicit baseline entry, requires baseline/current preview
--baseline-data-offset <n> independent baseline payload offset, default 0; comparison only
--data-preview-json <path> returned window or explicit comparison to a new .json
--find-data <query> exact UTF-8 byte search within data payloads, including overlaps
--find-data-hex <hex> exact payload bytes from compact hex pairs; excludes --find-data
--find-data-json <path> save every hit to a new .json; requires either query
--find-functions <query> case-sensitive literal search of local raw/display names
--find-functions-json <path> save all matches to a new .json; requires a query
--diff-functions-json <path> save full function/package comparison; implies diff-functions and requires baseline
--summary-json <path> save full ordinary analysis to a new .json; Top never truncates it
--instructions <n> inspect a local function in the full function index space
--instructions-json <path> save complete groups/instructions or explicit comparison to a new .json
--baseline-instructions <n> explicit baseline function index; requires instructions/baseline
--data-duplicates group exact data payloads within the current input
--data-duplicates-json <path> write full groups and source entries to a new .json
only Top and own JSON; text previews 20 members per group
--imports list host import declarations and their encoding bytes
--imports-json <path> write all declarations to a new .json file; implies --imports
unsupported descriptors fail; baseline requires --diff-imports
--diff-imports compare import names/kinds/counts; requires --baseline
type compatibility not evaluated; differences still return 0
--exports list exact host-visible declarations and declared-target aliases
--diff-exports compare exact export names/kinds; requires --baseline
--exports-json <path> write complete exports to a new .json file; implies --exports
--metadata account for custom/name physical file bytes
--diff-metadata compare outer custom encodings; requires --baseline
--metadata-json <path> write full metadata to a new .json file; implies --metadata
partial optional name details still return 0 with diagnostics
--duplicates group exact local body bytes, excluding length prefixes
--duplicates-json <path> write complete groups to a new .json file
--entrypoints show model-reachable, exclusive and shared function bytes
--entrypoints-json <path> write complete results to a new .json file
--generics group supported raw symbols by encoded function bytes
--generics-json <path> write full groups to a new .json file; implies --generics
--find-opcode <mnemonic> exact decoded locations in all local bodies
--find-opcode-json <path> all matching sites to a new .json; requires query
--opcode-stats aggregate all local function instruction encodings; Top/own JSON
--diff-opcodes compare both module aggregates; requires --baseline
--opcode-stats-json <path> full opcode/function summaries to a new .json; implies mode
--local-accesses <n> inspect local.get/set/tee encodings; Top/own JSON only
--local-accesses-json <path> save full accesses/groups to a new .json; requires query
--locals <n> inspect local declaration groups; Top/own JSON or explicit baseline pair
--locals-json <path> save all groups or explicit comparison to a new .json
--baseline-locals <n> baseline target; requires locals and baseline
--calls <n> list call instructions in one local body; Top/own JSON only
--calls-json <path> save all call sites to a new .json; requires calls
--compare-dependencies <left> <right> two outgoing closures in one input; Top/strict
--compare-dependencies-json <path> full sets to a new .json; requires pair
--path-between <from> <to> one shortest model path; strict/own JSON only, no Top
--path-between-json <path> full path to a new .json; requires explicit pair
--dependents <n> transitive model referrers to any function; Top/strict
--dependents-json <path> full reverse closure to a new .json; requires dependents
--dependents-dot <path> full incoming subgraph with original arrows; exclusive with JSON; Top only limits text
--dependencies <n> transitive model closure from any function; Top/strict allowed
--dependencies-json <path> full closure to a new .json; requires dependencies
--dependencies-dot <path> full subgraph to a new .dot; exclusive with JSON; Top only limits text
--cycles query reference-model cyclic components; Top/strict allowed
--cycle-witness add one closed model path per component; requires cycles
--cycles-json <path> complete cycles JSON to a new .json; implies cycles
--callers <n> list recorded one-hop incoming instruction sources
--callers-json <path> write full callers JSON to a new .json file; requires --callers
--why-index <n> explain a shortest model reference path to function n
--why-root <n> search from one actual model root (requires --why-index)
--why-json <path> write path JSON; refuses existing paths
query mode allows only these flags and --strict
element functions are conservative roots; paths are
not execution traces or predictions of savings
All report outputs refuse existing files, directories and link aliases.
Targets are checked together; each file is created exclusively. Output errors use exit 1.
Multiple files are not a transaction; a later failure may leave earlier new outputs.
Exit codes: 0 completed, 1 input/query/output/unavailable measurement, 2 bad arguments/config,
3 over budget, incomplete strict graph, or path search limited.moonsize app.wasm --retained --dead-code # the full text report
moonsize app.wasm --html report.html # charts, opens in a browser
moonsize app.wasm --call-graph graph.dot # for Graphvizmoonsize after.wasm --baseline before.wasm --experiment experiment.html \
--experiment-context context.json --top 20moonsize after.wasm --baseline before.wasm --budget moonsize-budget.json \
--budget-json budget-result.json --budget-md budget-summary.mdnode scripts/demo-budget.mjs _build/native/release/build/cmd/main/main.exe
_build/native/release/build/cmd/main/main.exe _build/budget-demo/after.wasm \
--baseline _build/budget-demo/before.wasm --budget examples/budget.jsonmoonsize app.wasm --callers 42 --top 20
moonsize app.wasm --callers 42 --callers-json new-callers.jsonmoonsize app.wasm --imports --top 20
moonsize app.wasm --imports-json new-imports.jsonmoonsize after.wasm --baseline before.wasm --diff-imports --top 20
moonsize after.wasm --baseline before.wasm --diff-imports --imports-json new-imports-diff.jsonmoonsize app.wasm --exports --top 20
moonsize app.wasm --exports-json new-exports.jsonmoonsize after.wasm --baseline before.wasm --diff-exports --top 20
moonsize after.wasm --baseline before.wasm --diff-exports --exports-json new-exports-diff.jsonmoonsize app.wasm --metadata --top 20
moonsize app.wasm --metadata-json new-metadata.jsonmoonsize after.wasm --baseline before.wasm --diff-metadata --top 20
moonsize after.wasm --baseline before.wasm --diff-metadata --metadata-json new-metadata-diff.jsonmoonsize app.wasm --duplicates --top 20
moonsize app.wasm --duplicates-json new-duplicates.jsonmoonsize app.wasm --entrypoints --top 20
moonsize app.wasm --entrypoints-json new-entrypoints.json
moonsize app.wasm --entrypoints --strictmoonsize app.wasm --generics --top 20
moonsize app.wasm --generics-json new-generics.jsonmoonsize app.wasm --why-index 47
moonsize app.wasm --why-index 47 --why-root 0
moonsize app.wasm --why-index 47 --why-json function-path.json --strictnode scripts/test-function-path.mjs _build/native/release/build/cmd/main/main.exe
node scripts/demo-function-path.mjs _build/native/release/build/cmd/main/main.exefn main {
let bytes : Bytes = read("app.wasm")
match @moonsize.parse_module(bytes) {
Ok(parsed) =>
match @moonsize.analyze(bytes, parsed) {
Ok(analysis) => {
let options = @moonsize.Options::default("app.wasm")
// What the five heaviest functions cost, as text or as numbers:
// `analysis.stats` and `analysis.retained` are there to be read.
println(@moonsize.render_top_functions(analysis.stats, analysis.data.length(), 5))
println(@moonsize.render_graph_warning(analysis.graph))
println(@moonsize.render_dead_code(analysis, 5))
println(@moonsize.render_retained(analysis, 5))
println(@moonsize.render_html(analysis, options.path))
}
Err(error) => println(@moonsize.describe_error(error))
}
Err(error) => println(@moonsize.describe_error(error))
}
}WARNING: the call graph has 1 analysis gap.
function 0, offset 42: call_ref: reference-call target analysis is not implemented.
Dead-code and retained-size results may be inaccurate; do not use them as proof that a function can be removed.| Variant | Fields |
|---|---|
| UnsupportedVersion | version-field offset, raw unsigned UInt value |
| DuplicateSection | second section's id-byte offset, kind |
| InvalidSectionOrder | current id-byte offset, kind, preceding standard kind |
| FunctionCodeCountMismatch | related section's id-byte offset, kind, local declaration count, body count |
| TrailingSectionBytes | first unconsumed payload byte offset, kind |
| Variant | Stable JSON code |
|---|---|
| NoStaticTableTargets | no_static_table_targets |
| UnmodeledReferenceCall | unmodeled_reference_call |
| ImportedTableContents | imported_table_contents |
| ExportedTableContents | exported_table_contents |
| RuntimeTableMutation | runtime_table_mutation |
| UnmodeledTableInitializer | unmodeled_table_initializer |
| UnknownTableContents | unknown_table_contents |
COMPRESSED SIZE
raw 10675 B
gzip 5207 B (48.7% of raw, ratio 2.05x)
BY SECTION — INDEPENDENT GZIP STREAMS
SECTION RAW GZIP RATIO
code 5166 2712 1.90x
custom (name) 4975 1983 2.50x
data 252 174 1.44x
custom (producers) 71 95 0.74x
type 59 66 0.89x
function 50 63 0.79x
import 37 61 0.60x
export 21 45 0.46x
global 13 34 0.38x
element 8 32 0.25x
table 7 31 0.22x
memory 5 29 0.17x
datacount 3 27 0.11x
Section gzip sizes are measured independently and are not additive.
They do not represent shares of the whole-file gzip size.Retained size
# INDEX SIZE RETAINED DIES SHARE IND FUNCTION
1 47 158 5162 46 48.3% ____moonbit__main
2 39 301 1773 10 16.6% int::Int::to__string_2einner
3 37 24 887 8 8.3% println
4 34 9 819 5 7.6% moonbit.println
5 33 206 810 4 7.5% moonbit.fprintln
6 28 49 717 7 6.7% moonbit.decref
7 29 409 668 6 6.2% moonbit.gc.free
8 43 633 633 0 5.9% int__to__string__dec
DIES counts the other functions that become unreachable with this one.
IND marks a function an indirect call could reach.
Dead code
0 of 47 functions are unreachable from the roots
0 bytes (0.0% of file)
every function is reachablemoonsize examples/fib.wasm --html new-report.html

moonsize app.wasm --max-size 100KB # a ceiling on the file
moonsize app.wasm --baseline main.wasm --max-size 5KB # at most 5 KB of growthSIZE COMPARISON
baseline current delta
total 10675 11039 +364 (+3.4%)
code 5166 5299 +133 (+2.5%)
custom (name) 4975 5205 +230 (+4.6%)
data 252 252 0 (0.0%)
custom (producers) 71 71 0 (0.0%)
... baseline current delta
custom (x) 10 13 +3 (+30.0%)moonsize current.wasm --baseline previous.wasm --diff-functions --top 20package encoded-byte sums = local function total_size sums
code section = function encoding + code overhead (header/count encoding)
function delta = matched delta + added bytes - removed bytes
+ unmatched current bytes - unmatched baseline bytesmoon build --target native --release
bash scripts/demo-function-diff.sh _build/native/release/build/cmd/main/main.exe- uses: ./.github/actions/setup-moonbit
- name: Build the example and CLI
run: |
moon build --target wasm
moon build --target native --release
- name: The example stays inside its budget
env:
EXAMPLE: _build/wasm/debug/build/examples/examples.wasm
CLI: _build/native/release/build/cmd/main/main.exe
run: |
test -s "$EXAMPLE"
printf 'budget input: %s\nbytes: %s\n' "$EXAMPLE" "$(wc -c < "$EXAMPLE")"
sha256sum "$EXAMPLE"
"$CLI" "$EXAMPLE" --max-size 100KB- name: Setup MoonBit
run: |
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash -s '0.10.13+cbb11c36f'
echo "$HOME/.moon/bin" >> "$GITHUB_PATH"
- run: moon update
- run: moon build --target wasm --release
- name: Size budget
run: moonsize _build/wasm/release/build/app/app.wasm --max-size 250KB- name: Build the base branch
run: |
git worktree add "$RUNNER_TEMP/base" "origin/${{ github.base_ref }}"
(cd "$RUNNER_TEMP/base" && moon build --target wasm --release)
- name: Size budget
run: |
moonsize _build/wasm/release/build/app/app.wasm \
--baseline "$RUNNER_TEMP/base/_build/wasm/release/build/app/app.wasm" \
--max-size 5KBmoon check --target native --deny-warn
moon test
moon build --target native --release
bash scripts/test-tail-calls.sh _build/native/release/build/cmd/main/main.exe
bash scripts/test-graph-diagnostics.sh _build/native/release/build/cmd/main/main.exe
bash scripts/test-parser-boundaries.sh _build/native/release/build/cmd/main/main.exemoon build --target wasm
stage=$(mktemp -d examples/report-update.XXXXXX)
cp _build/wasm/debug/build/examples/examples.wasm "$stage/fib.wasm"
moon run cmd/main -- \
--html "$stage/report.html" \
"$stage/fib.wasm"
sha256sum _build/wasm/debug/build/examples/examples.wasm "$stage/fib.wasm"cp "$stage/fib.wasm" examples/fib.wasm
cp "$stage/report.html" examples/report.htmlpub struct Analysis {
data : Bytes
parsed : WasmModule
stats : Array[FunctionStat]
graph : CallGraph
roots : Set[Int]
reachable : Set[Int]
retained : Array[RetainedSize]
indirect : Set[Int]
graph_complete : Bool
unresolved_count : Int
}pub struct BudgetArtifact {
sha256 : String
raw_bytes : Int
code_bytes : Int
gzip : Result[Int, String]?
coverage : BudgetCoverage?
}pub struct BudgetCoverage {
functions : Int
function_bytes : Int
unattributed_functions : Int
unattributed_bytes : Int
}pub struct BudgetReport {
config_version : Int
current : BudgetArtifact
baseline : BudgetArtifact?
rules : Array[BudgetRuleResult]
status : BudgetStatus
exit_code : Int
}pub struct BudgetRuleResult {
id : String
metric : String
package_name : String?
mode : String
current : Int?
baseline : Int?
delta : Int?
max_bytes : Int
status : BudgetStatus
reason : String
current_package_present : Bool?
baseline_package_present : Bool?
}pub struct CallGraph {
calls : Map[Int, Set[Int]]
called_by : Map[Int, Set[Int]]
indirect_sites : Array[IndirectSite]
unresolved_indirect : Array[IndirectSite]
diagnostics : Array[GraphDiagnostic]
edges : Array[CallEdge]
}pub enum CallKind {
Direct(Int)
Indirect(Int)
Reference
}pub struct CodeSizeSummary {
code_size : Int
function_count : Int
function_bytes : Int
overhead : Int
}type CompiledBudgetpub struct DataHexSearchReport {
file_size : Int
sha256 : String
query_hex : String
query_size : Int
matching_rule : String
scope : String
data_segments : DataSegmentsReport
segment_count : Int
matched_segment_count : Int
unmatched_segment_count : Int
occurrence_count : Int
matches : Array[DataSearchMatch]
}pub struct DataPayloadGroup {
id : Int
sha256 : String
payload_length : Int
kind : DataPayloadGroupKind
baseline_indices : Array[Int]
current_indices : Array[Int]
baseline : DataGroupTotals
current : DataGroupTotals
delta : DataGroupTotals
}pub struct DataPreviewComparison {
baseline : DataPreviewReport
current : DataPreviewReport
same_count : Int
different_count : Int
baseline_only_count : Int
current_only_count : Int
compared_positions : Int
returned_size_delta : Int
positions : Array[DataPreviewPosition]
scope : String
}pub enum DataPreviewComparisonError {
BaselineDataPreviewError(DataPreviewError)
CurrentDataPreviewError(DataPreviewError)
}pub enum DataPreviewError {
InvalidDataPreviewLimit(Int)
InvalidDataPreviewIndex(Int, Int)
InvalidDataPreviewOffset(Int, Int)
DataPreviewInputError(WasmError)
}pub struct DataPreviewReport {
file_size : Int
sha256 : String
segment_count : Int
segment : DataSegment
payload_offset : Int
requested_limit : Int
window : DataByteRange
returned_size : Int
remaining_bytes : Int
bytes : Bytes
scope : String
}pub struct DataSearchReport {
file_size : Int
sha256 : String
query : String
query_size : Int
matching_rule : String
scope : String
data_segments : DataSegmentsReport
segment_count : Int
matched_segment_count : Int
unmatched_segment_count : Int
occurrence_count : Int
matches : Array[DataSearchMatch]
}pub struct DataSegment {
index : Int
mode : DataSegmentMode
memory_index : Int?
encoding : DataByteRange
payload : DataByteRange
offset_expression : DataByteRange?
mode_size : Int
memory_index_size : Int
payload_length_size : Int
} derive(Eq, Debug)pub struct DataSegmentsComparison {
baseline_sha256 : String
current_sha256 : String
baseline : DataSegmentsReport
current : DataSegmentsReport
groups : Array[DataPayloadGroup]
delta : DataSegmentsDelta
}pub struct DataSegmentsReport {
file_size : Int
section : Section?
datacount : Int?
section_size : Int
header_size : Int
count_size : Int
payload_size : Int
entry_metadata_size : Int
entries : Array[DataSegment]
}pub enum DependencyOverlapError {
OverlapInputError(WasmError)
InvalidOverlapTarget(String, Int, Int)
OverlapEvidenceError(FunctionDependenciesError)
}pub struct DependencyOverlapGroup {
kind : String
indices : Array[Int]
function_count : Int
local_count : Int
imported_count : Int
local_encoded_bytes : Int
}pub struct DependencyOverlapReport {
file_size : Int
sha256 : String
left_index : Int
right_index : Int
functions : Array[FunctionPathNode]
left_reachable : Array[Int]
right_reachable : Array[Int]
left_edges : Array[CallEdge]
right_edges : Array[CallEdge]
groups : Array[DependencyOverlapGroup]
function_count : Int
local_function_count : Int
imported_function_count : Int
local_encoded_bytes : Int
left_function_count : Int
left_local_count : Int
left_imported_count : Int
left_local_encoded_bytes : Int
right_function_count : Int
right_local_count : Int
right_imported_count : Int
right_local_encoded_bytes : Int
union_function_count : Int
union_local_count : Int
union_imported_count : Int
union_local_encoded_bytes : Int
graph_complete : Bool
unresolved_count : Int
diagnostics : Array[GraphDiagnostic]
graph_warning : String
modeling_scope : String
}pub struct DuplicateDataGroup {
id : Int
sha256 : String
payload_size : Int
member_count : Int
member_indices : Array[Int]
member_payload_bytes : Int
member_metadata_bytes : Int
member_encoded_bytes : Int
}pub struct DuplicateDataReport {
file_size : Int
sha256 : String
comparison_scope : String
data_segments : DataSegmentsReport
groups : Array[DuplicateDataGroup]
summary : DuplicateDataSummary
}pub struct DuplicateDataSummary {
segment_count : Int
duplicate_group_count : Int
duplicate_member_count : Int
singleton_count : Int
total_payload_bytes : Int
duplicate_member_payload_bytes : Int
singleton_payload_bytes : Int
total_entry_encoded_bytes : Int
total_entry_metadata_bytes : Int
duplicate_member_metadata_bytes : Int
duplicate_member_encoded_bytes : Int
singleton_metadata_bytes : Int
singleton_encoded_bytes : Int
data_section_bytes : Int
section_header_bytes : Int
count_prefix_bytes : Int
} derive(Eq, Debug)pub struct DuplicateFunctionGroup {
sha256 : String
body_size : Int
member_count : Int
member_body_bytes : Int
member_prefix_bytes : Int
member_total_bytes : Int
members : Array[DuplicateFunctionMember]
}pub struct DuplicateFunctionMember {
index : Int
name : String
raw_name : String?
type_index : Int
offset : Int
body_offset : Int
body_size : Int
prefix_size : Int
total_size : Int
}pub struct DuplicateFunctionsReport {
file_size : Int
sha256 : String
comparison_scope : String
summary : DuplicateFunctionsSummary
groups : Array[DuplicateFunctionGroup]
}pub struct DuplicateFunctionsSummary {
local_function_count : Int
duplicate_group_count : Int
duplicate_member_count : Int
singleton_function_count : Int
total_body_bytes : Int
duplicate_body_bytes : Int
singleton_body_bytes : Int
total_prefix_bytes : Int
total_encoded_bytes : Int
}pub struct EntrypointFunction {
node : FunctionPathNode
entrypoints : Array[Int]
other_root_reachable : Bool
}pub enum EntrypointsError {
EntrypointsInputError(WasmError)
InvalidEntrypointExport(String, Int, Int, Int)
InvalidEntrypointsRoot(String, Int, Int)
InvalidEntrypointsEdge(Int, Int, Int)
InvalidEntrypointsExportKind(String, Int, Int)
}pub struct EntrypointsLedger {
local_function_count : Int
total_local_bytes : Int
export_union_local_count : Int
export_union_bytes : Int
not_export_reachable_bytes : Int
exclusive_model_bytes : Int
shared_model_bytes : Int
}pub struct EntrypointsReport {
file_size : Int
sha256 : String
export_name_count : Int
entrypoint_count : Int
other_exports : Array[Export]
entrypoints : Array[EntrypointGroup]
functions : Array[EntrypointFunction]
other_roots : Array[FunctionRoot]
other_root_reachable : Array[Int]
shared_local_functions : Array[Int]
ledger : EntrypointsLedger
graph_complete : Bool
diagnostics : Array[GraphDiagnostic]
graph_warning : String
modeling_scope : String
}pub struct Export {
name : String
kind : Int
index : Int
}pub struct ExportComparisonRow {
name : String
status : String
baseline : ExportDeclaration?
current : ExportDeclaration?
declaration_bytes_delta : Int
target_index_changed : Bool?
}pub struct ExportDeclaration {
ordinal : Int
name : String
kind : String
kind_code : Int
target_index : UInt
encoding : ExportByteRange
name_encoding : ExportByteRange
name_length_prefix_bytes : Int
name_utf8_bytes : Int
descriptor : ExportByteRange
target_index_prefix_bytes : Int
}pub struct ExportTarget {
kind : String
kind_code : Int
target_index : UInt
entry_ordinals : Array[Int]
member_count : Int
declaration_bytes : Int
is_alias : Bool
}pub struct ExportsComparison {
baseline : ExportsReport
current : ExportsReport
counts : ExportsComparisonCounts
delta : ExportsLedger
baseline_non_export_bytes : Int
current_non_export_bytes : Int
delta_non_export_bytes : Int
delta_file_bytes : Int
rows : Array[ExportComparisonRow]
comparison_scope : String
}pub struct ExportsReport {
file_size : Int
sha256 : String
section : ExportByteRange?
count_encoding : ExportByteRange?
summary : ExportsSummary
ledger : ExportsLedger
entries : Array[ExportDeclaration]
targets : Array[ExportTarget]
supported_scope : String
}pub struct ExportsSummary {
export_count : Int
kind_counts : ExportKindCounts
distinct_target_count : Int
alias_group_count : Int
alias_member_count : Int
singleton_target_count : Int
} derive(Eq, Debug)pub struct FileOffsetDecodeDetail {
kind : FileOffsetDecodeDetailKind
file_offset : Int
size : Int
relative_offset : Int
instruction : FunctionInstructionRecord?
}pub enum FileOffsetDecodeError {
FileOffsetDecodeLocationError(FileOffsetError)
FileOffsetDecodeInstructionsError(FunctionInstructionsError)
InconsistentFileOffsetDecode(Int, String)
}pub struct FileOffsetDecodedReport {
location : FileOffsetReport
decode_status : FileOffsetDecodeStatus
detail : FileOffsetDecodeDetail?
scope : String
}pub enum FileOffsetError {
FileOffsetOutOfRange(Int, Int)
FileOffsetInputError(WasmError)
InconsistentFileOffsetRange(Int, String)
}pub struct FileOffsetRegion {
kind : FileOffsetKind
file_offset : Int
size : Int
relative_offset : Int
} derive(Eq, Debug)pub struct FileOffsetReport {
file_size : Int
sha256 : String
offset : Int
section_index : Int?
section : Section?
function : FunctionStat?
data_segment : DataSegment?
region : FileOffsetRegion
scope : String
}pub enum FileRangeError {
FileRangeOutOfRange(Int, Int, Int)
FileRangeOwnershipError(Int, Int, Int, FileOffsetError)
InconsistentFileRange(Int, Int, Int, String)
}pub struct FileRangePart {
kind : FileOffsetKind
owner_range : DataByteRange
overlap_range : DataByteRange
query_relative_offset : Int
owner_relative_offset : Int
section_index : Int?
section : Section?
function : FunctionStat?
data_segment : DataSegment?
}pub struct FileRangeReport {
file_size : Int
sha256 : String
query : DataByteRange
covered_size : Int
parts : Array[FileRangePart]
scope : String
}pub struct FunctionBody {
index : Int
body_size : Int
total_size : Int
offset : Int
}pub struct FunctionCallRecord {
instruction_ordinal : Int
opcode : Opcode
kind : FunctionCallKind
is_tail : Bool
file_offset : Int
body_relative_offset : Int
encoded_size : Int
target_index : Int?
type_index : Int?
table_index : Int?
target : FunctionPathNode?
}pub enum FunctionCallersError {
CallersInputError(WasmError)
InvalidCallersTarget(Int, Int)
InvalidCallersEvidence(Int, String)
}pub struct FunctionCallersReport {
target : FunctionPathNode
file_size : Int
sha256 : String
callers : Array[FunctionCallerGroup]
caller_count : Int
source_count : Int
graph_complete : Bool
diagnostics : Array[GraphDiagnostic]
graph_warning : String
modeling_scope : String
}pub enum FunctionCallsError {
CallsInputError(WasmError)
InvalidCallsTarget(Int, Int)
ImportedCallsTarget(Int)
InvalidCallsEvidence(Int?, String)
}pub struct FunctionCallsReport {
file_size : Int
sha256 : String
caller : FunctionPathNode
entry : FunctionInstructionRange
prefix : FunctionInstructionRange
body : FunctionInstructionRange
locals_encoding : FunctionInstructionRange
instruction_count : Int
instruction_bytes : Int
call_count : Int
direct_count : Int
indirect_count : Int
reference_call_count : Int
tail_count : Int
call_encoding_bytes : Int
other_instruction_bytes : Int
calls : Array[FunctionCallRecord]
scope : String
}pub struct FunctionCycleComponent {
component_id : Int
members : Array[FunctionPathNode]
internal_edges : Array[CallEdge]
node_count : Int
internal_edge_count : Int
direct_edges : Int
reference_edges : Int
indirect_edges : Int
local_encoded_bytes : Int
}pub enum FunctionCycleWitnessError {
CycleWitnessQueryError(FunctionCyclesError)
InvalidCycleWitness(Int, Int?, String)
}pub struct FunctionCycleWitnessReport {
cycles : FunctionCyclesReport
witnesses : Array[FunctionCycleWitness]
scope : String
}pub struct FunctionCyclesReport {
file_size : Int
sha256 : String
function_count : Int
imported_function_count : Int
local_function_count : Int
cyclic_function_count : Int
non_cyclic_function_count : Int
component_count : Int
components : Array[FunctionCycleComponent]
local_encoded_bytes : Int
cyclic_local_encoded_bytes : Int
other_local_encoded_bytes : Int
graph_complete : Bool
unresolved_count : Int
diagnostics : Array[GraphDiagnostic]
graph_warning : String
modeling_scope : String
}pub enum FunctionDependenciesError {
DependenciesInputError(WasmError)
InvalidDependenciesTarget(Int, Int)
InvalidDependenciesEvidence(Int, Int, String)
}pub struct FunctionDependenciesReport {
target : FunctionPathNode
file_size : Int
sha256 : String
function_count : Int
local_function_count : Int
imported_function_count : Int
nodes : Array[FunctionDependencyNode]
edges : Array[CallEdge]
reachable_function_count : Int
other_function_count : Int
reachable_local_count : Int
reachable_imported_count : Int
dependency_function_count : Int
local_encoded_bytes : Int
reachable_local_encoded_bytes : Int
other_local_encoded_bytes : Int
target_local_encoded_bytes : Int
dependency_local_encoded_bytes : Int
edge_count : Int
direct_edges : Int
reference_edges : Int
indirect_edges : Int
graph_complete : Bool
unresolved_count : Int
diagnostics : Array[GraphDiagnostic]
graph_warning : String
modeling_scope : String
}pub enum FunctionDependentsError {
DependentsInputError(WasmError)
InvalidDependentsTarget(Int, Int)
InvalidDependentsEvidence(Int, Int, String)
}pub struct FunctionDependentsReport {
target : FunctionPathNode
file_size : Int
sha256 : String
function_count : Int
local_function_count : Int
imported_function_count : Int
nodes : Array[FunctionDependentNode]
edges : Array[CallEdge]
reaching_function_count : Int
other_function_count : Int
reaching_local_count : Int
reaching_imported_count : Int
dependent_function_count : Int
local_encoded_bytes : Int
reaching_local_encoded_bytes : Int
other_local_encoded_bytes : Int
target_local_encoded_bytes : Int
dependent_local_encoded_bytes : Int
edge_count : Int
direct_edges : Int
reference_edges : Int
indirect_edges : Int
graph_complete : Bool
unresolved_count : Int
diagnostics : Array[GraphDiagnostic]
graph_warning : String
modeling_scope : String
}pub struct FunctionInstructionRange {
file_offset : Int
size : Int
}pub struct FunctionInstructionRecord {
ordinal : Int
mnemonic : String
file_offset : Int
body_relative_offset : Int
encoded_size : Int
}pub struct FunctionInstructionsComparison {
baseline : FunctionInstructionsReport
current : FunctionInstructionsReport
delta : FunctionInstructionsDelta
opcodes : Array[FunctionOpcodeDelta]
scope : String
}pub enum FunctionInstructionsComparisonError {
BaselineInstructionsError(Int, FunctionInstructionsError)
CurrentInstructionsError(Int, FunctionInstructionsError)
}pub struct FunctionInstructionsDelta {
entry_bytes : Int
prefix_bytes : Int
body_bytes : Int
locals_bytes : Int
instruction_bytes : Int
instruction_count : Int
}pub enum FunctionInstructionsError {
InstructionsInputError(WasmError)
InvalidInstructionsTarget(Int, Int)
ImportedInstructionsTarget(Int)
InvalidInstructionsRange(Int, String)
}pub struct FunctionInstructionsReport {
file_size : Int
sha256 : String
index : Int
name : String
raw_name : String?
entry : FunctionInstructionRange
prefix : FunctionInstructionRange
body : FunctionInstructionRange
locals_encoding : FunctionInstructionRange
instruction_bytes : Int
instruction_count : Int
groups : Array[FunctionOpcodeGroup]
instructions : Array[FunctionInstructionRecord]
scope : String
}pub struct FunctionLocalAccess {
instruction_ordinal : Int
opcode : Opcode
local_index : Int
file_offset : Int
body_relative_offset : Int
encoded_size : Int
index_encoding : FunctionInstructionRange
}pub struct FunctionLocalAccessGroup {
local_index : Int
access_count : Int
get_count : Int
set_count : Int
tee_count : Int
encoded_bytes : Int
index_encoding_bytes : Int
instruction_ordinals : Array[Int]
}pub enum FunctionLocalAccessesError {
LocalAccessesInputError(WasmError)
InvalidLocalAccessesTarget(Int, Int)
ImportedLocalAccessesTarget(Int)
InvalidLocalAccessesEvidence(Int?, String)
}pub struct FunctionLocalAccessesReport {
file_size : Int
sha256 : String
target : FunctionPathNode
entry : FunctionInstructionRange
prefix : FunctionInstructionRange
body : FunctionInstructionRange
locals_encoding : FunctionInstructionRange
instruction_count : Int
instruction_bytes : Int
access_count : Int
get_count : Int
set_count : Int
tee_count : Int
distinct_local_index_count : Int
access_encoding_bytes : Int
index_encoding_bytes : Int
other_instruction_bytes : Int
accesses : Array[FunctionLocalAccess]
groups : Array[FunctionLocalAccessGroup]
scope : String
}pub struct FunctionLocalGroup {
group_index : Int
quantity : UInt
declared_ordinal_start : UInt64
declared_ordinal_end : UInt64
encoding : FunctionInstructionRange
quantity_encoding : FunctionInstructionRange
type_encoding : FunctionInstructionRange
type_hex : String
type_label : String?
}pub struct FunctionLocalsComparison {
baseline : FunctionLocalsReport
current : FunctionLocalsReport
delta : FunctionLocalsDelta
type_encodings : Array[FunctionLocalsTypeEncoding]
scope : String
}pub enum FunctionLocalsComparisonError {
BaselineLocalsError(Int, FunctionLocalsError)
CurrentLocalsError(Int, FunctionLocalsError)
}pub struct FunctionLocalsDelta {
entry_bytes : Int
prefix_bytes : Int
body_bytes : Int
locals_bytes : Int
group_count_encoding_bytes : Int
quantity_encoding_bytes : Int
type_encoding_bytes : Int
body_remainder_bytes : Int
group_count : Int
declared_count_delta_decimal : String
}pub enum FunctionLocalsError {
LocalsInputError(WasmError)
InvalidLocalsTarget(Int, Int)
ImportedLocalsTarget(Int)
InvalidLocalsEncoding(Int?, String)
}pub struct FunctionLocalsReport {
file_size : Int
sha256 : String
target : FunctionPathNode
entry : FunctionInstructionRange
prefix : FunctionInstructionRange
body : FunctionInstructionRange
locals_encoding : FunctionInstructionRange
group_count_encoding : FunctionInstructionRange
body_remainder : FunctionInstructionRange
group_count : Int
declared_count : UInt64
quantity_encoding_bytes : Int
type_encoding_bytes : Int
groups : Array[FunctionLocalGroup]
scope : String
}pub struct FunctionLocalsTypeDelta {
group_count : Int
declared_count_delta_decimal : String
quantity_encoding_bytes : Int
type_encoding_bytes : Int
group_bytes : Int
}pub struct FunctionLocalsTypeEncoding {
type_hex : String
type_label : String?
presence : String
baseline : FunctionLocalsTypeTotals
current : FunctionLocalsTypeTotals
delta : FunctionLocalsTypeDelta
}pub struct FunctionLocalsTypeTotals {
group_indices : Array[Int]
group_count : Int
declared_count : UInt64
quantity_encoding_bytes : Int
type_encoding_bytes : Int
group_bytes : Int
}pub enum FunctionMatchStatus {
Matched
AddedSymbol
RemovedSymbol
AmbiguousSymbol
MissingSymbol
} derive(Eq)pub struct FunctionOpcodeDelta {
mnemonic : String
baseline_count : Int
current_count : Int
count_delta : Int
baseline_encoded_bytes : Int
current_encoded_bytes : Int
encoded_bytes_delta : Int
}pub struct FunctionOpcodeGroup {
mnemonic : String
count : Int
encoded_bytes : Int
}pub enum FunctionPathBetweenError {
BetweenDependenciesError(FunctionDependenciesError)
InvalidBetweenTarget(Int, Int)
InvalidBetweenEvidence(Int?, Int?, Int?, String)
}pub struct FunctionPathBetweenReport {
source : FunctionPathNode
target_index : Int
file_size : Int
sha256 : String
function_count : Int
status : FunctionPathBetweenStatus
path_nodes : Array[FunctionPathNode]
path_edges : Array[CallEdge]
hop_count : Int?
prepared_closure_function_count : Int
graph_complete : Bool
unresolved_count : Int
diagnostics : Array[GraphDiagnostic]
graph_warning : String
modeling_scope : String
}pub enum FunctionPathError {
PathInputError(WasmError)
InvalidPathTarget(Int, Int)
InvalidPathRoot(Int)
InvalidPathLimits(String)
InvalidPathRootReference(Int, Int)
InvalidPathEdgeIndex(Int, Int)
InvalidPathEdgeEvidence(Int)
}pub struct FunctionPathNode {
index : Int
name : String
raw_name : String?
imported : Bool
encoded_size : Int?
import_module : String?
import_name : String?
}pub struct FunctionPathReport {
target : FunctionPathNode
requested_root : Int?
roots : Array[FunctionRoot]
selected_roots : Array[Int]
status : FunctionPathStatus
path_root : Int?
nodes : Array[FunctionPathNode]
steps : Array[FunctionPathStep]
graph_complete : Bool
diagnostics : Array[GraphDiagnostic]
graph_warning : String
limits : PathLimits
search_stats : PathSearchStats
}pub struct FunctionRootReason {
function_index : Int
kind : FunctionRootKind
name : String?
section_offset : Int
ordinal : Int?
table_index : Int?
element_mode : String?
}pub struct FunctionSearchMatch {
index : Int
name : String
raw_name : String
module_name : String
offset : Int
body_size : Int
total_size : Int
matched_raw_name : Bool
matched_display_name : Bool
}pub struct FunctionSearchReport {
file_size : Int
sha256 : String
query : String
matching_rule : String
scope : String
local_function_count : Int
named_count : Int
unnamed_count : Int
match_count : Int
unmatched_named_count : Int
matched_body_bytes : Int
matched_prefix_bytes : Int
matched_encoded_bytes : Int
matches : Array[FunctionSearchMatch]
}pub struct FunctionSizeChange {
status : FunctionMatchStatus
raw_name : String?
baseline : FunctionStat?
current : FunctionStat?
delta : Int
}pub struct FunctionStat {
index : Int
name : String
raw_name : String?
module_name : String
body_size : Int
total_size : Int
offset : Int
}pub struct GenericCoverage {
total_functions : Int
total_size : Int
grouped_functions : Int
grouped_size : Int
named_ungrouped_functions : Int
named_ungrouped_size : Int
unnamed_functions : Int
unnamed_size : Int
}pub struct GenericFamily {
family_key : String
display_name : String
definition_count : Int
type_encoding_count : Int
total_size : Int
instances : Array[GenericInstance]
}pub struct GenericInstance {
index : Int
raw_name : String
raw_type_arguments : String
type_labels : Array[String]
total_size : Int
}pub struct GenericInstancesReport {
file_size : Int
sha256 : String
name_status : String
recognition_scope : String
coverage : GenericCoverage
families : Array[GenericFamily]
}pub struct GraphDiagnostic {
kind : GraphDiagnosticKind
caller : Int
offset : Int
opcode : Opcode
type_index : Int?
table_index : Int?
source : GraphDiagnosticSource?
}pub enum GraphDiagnosticKind {
NoStaticTableTargets
UnmodeledReferenceCall
ImportedTableContents
ExportedTableContents
RuntimeTableMutation
UnmodeledTableInitializer
UnknownTableContents
}pub struct ImportDeclaration {
ordinal : Int
kind : String
kind_index : Int
module_name : String
field : String
encoding : ImportByteRange
module_encoding : ImportByteRange
field_encoding : ImportByteRange
descriptor : ImportByteRange
module_length_prefix_bytes : Int
module_utf8_bytes : Int
field_length_prefix_bytes : Int
field_utf8_bytes : Int
type_index : UInt?
limits : ImportLimits?
value_type : String?
mutability : Int?
}pub struct ImportInventoryGroup {
module_name : String
field : String
kind : String
status : String
baseline_ordinals : Array[Int]
current_ordinals : Array[Int]
baseline_count : Int
current_count : Int
overlap_count : Int
removed_count : Int
added_count : Int
count_delta : Int
baseline_entry_bytes : Int
current_entry_bytes : Int
entry_bytes_delta : Int
}pub struct ImportModule {
module_name : String
entry_count : Int
kind_counts : ImportKindCounts
entry_bytes : Int
ordinals : Array[Int]
}pub struct ImportsComparison {
baseline : ImportsReport
current : ImportsReport
groups : Array[ImportInventoryGroup]
counts : ImportInventoryCounts
inventory_changed : Bool
delta : ImportsLedger
comparison_scope : String
}pub struct ImportsLedger {
import_section_total_bytes : Int
section_header_bytes : Int
count_prefix_bytes : Int
entry_bytes : Int
module_name_encoding_bytes : Int
module_length_prefix_bytes : Int
module_utf8_bytes : Int
field_name_encoding_bytes : Int
field_length_prefix_bytes : Int
field_utf8_bytes : Int
descriptor_bytes : Int
} derive(Eq, Debug)pub struct ImportsReport {
file_size : Int
sha256 : String
supported_scope : String
section : ImportByteRange?
count_encoding : ImportByteRange?
entry_count : Int
kind_counts : ImportKindCounts
ledger : ImportsLedger
modules : Array[ImportModule]
entries : Array[ImportDeclaration]
}pub struct IndirectSite {
caller : Int
table_index : Int
type_index : Int
offset : Int
candidates : Array[Int]
}pub struct MatchingSummary {
matched_baseline : FunctionCoverage
matched_current : FunctionCoverage
added_symbols : FunctionCoverage
removed_symbols : FunctionCoverage
ambiguous_baseline : FunctionCoverage
ambiguous_current : FunctionCoverage
missing_baseline : FunctionCoverage
missing_current : FunctionCoverage
matched_delta : Int
}pub struct MetadataComparison {
baseline : MetadataReport
current : MetadataReport
delta : MetadataEncodingTotals
baseline_non_custom_bytes : Int
current_non_custom_bytes : Int
delta_non_custom_bytes : Int
delta_file_bytes : Int
categories : Array[MetadataComparisonGroup]
name_groups : Array[MetadataComparisonGroup]
comparison_scope : String
}pub struct MetadataComparisonGroup {
kind : String
name : String?
baseline_ordinals : Array[Int]
current_ordinals : Array[Int]
baseline : MetadataEncodingTotals
current : MetadataEncodingTotals
delta : MetadataEncodingTotals
}pub struct MetadataCustom {
ordinal : Int
section_ordinal : Int
encoding : MetadataRange
section_header_bytes : Int
name_encoding : MetadataRange
name_length_prefix_bytes : Int
name_bytes : MetadataRange
name : String?
category : String
content : MetadataRange
status : String
name_subsection_bytes : Int
unbounded_tail : MetadataRange?
}pub struct MetadataDiagnostic {
offset : Int
custom_ordinal : Int
subsection_ordinal : Int?
reason : String
}pub struct MetadataFunctionName {
custom_ordinal : Int
subsection_ordinal : Int
ordinal : Int
function_index : UInt
encoding : MetadataRange
index_prefix_bytes : Int
name_length_prefix_bytes : Int
name_bytes : MetadataRange
name : String?
}pub struct MetadataNameSubsection {
custom_ordinal : Int
ordinal : Int
id : Int
encoding : MetadataRange
header_bytes : Int
payload : MetadataRange
status : String
declared_count : UInt?
count_prefix_bytes : Int
parsed_record_bytes : Int
unparsed : MetadataRange?
}pub struct MetadataReport {
file_size : Int
sha256 : String
byte_ledger_complete : Bool
custom_name_status : String
name_details_status : String
modeling_scope : String
summary : MetadataSummary
categories : Array[MetadataCategory]
name_groups : Array[MetadataNameGroup]
customs : Array[MetadataCustom]
subsections : Array[MetadataNameSubsection]
function_names : Array[MetadataFunctionName]
diagnostics : Array[MetadataDiagnostic]
}pub struct MetadataSummary {
custom_count : Int
custom_bytes : Int
section_header_bytes : Int
custom_name_encoding_bytes : Int
content_bytes : Int
unavailable_custom_count : Int
unavailable_custom_bytes : Int
name_custom_count : Int
name_content_bytes : Int
name_subsection_bytes : Int
unbounded_name_tail_bytes : Int
function_name_payload_bytes : Int
function_name_count_prefix_bytes : Int
parsed_function_record_count : Int
parsed_function_record_bytes : Int
function_name_unparsed_bytes : Int
function_index_prefix_bytes : Int
function_name_length_prefix_bytes : Int
function_name_utf8_bytes : Int
unavailable_function_name_count : Int
}pub struct ModuleOpcodeChange {
mnemonic : String
status : String
baseline_count : Int
current_count : Int
count_delta : Int
baseline_encoded_bytes : Int
current_encoded_bytes : Int
encoded_bytes_delta : Int
baseline_function_count : Int
current_function_count : Int
function_count_delta : Int
}pub struct ModuleOpcodeComparison {
baseline : ModuleOpcodeReport
current : ModuleOpcodeReport
delta : ModuleOpcodeDelta
opcodes : Array[ModuleOpcodeChange]
scope : String
}pub enum ModuleOpcodeComparisonError {
BaselineModuleOpcodeError(ModuleOpcodeError)
CurrentModuleOpcodeError(ModuleOpcodeError)
}pub struct ModuleOpcodeDelta {
file_bytes : Int
code_bytes : Int
non_code_bytes : Int
code_header_bytes : Int
count_encoding_bytes : Int
body_prefix_bytes : Int
locals_encoding_bytes : Int
instruction_bytes : Int
instruction_count : Int
imported_function_count : Int
local_function_count : Int
}pub struct ModuleOpcodeFunction {
stat : FunctionStat
locals_encoding : FunctionInstructionRange
instruction_count : Int
instruction_bytes : Int
}pub struct ModuleOpcodeGroup {
mnemonic : String
count : Int
encoded_bytes : Int
function_count : Int
}pub struct ModuleOpcodeReport {
file_size : Int
sha256 : String
code_section : Section?
count_encoding : FunctionInstructionRange?
imported_function_count : Int
local_function_count : Int
code_header_bytes : Int
count_encoding_bytes : Int
body_prefix_bytes : Int
locals_encoding_bytes : Int
instruction_bytes : Int
instruction_count : Int
groups : Array[ModuleOpcodeGroup]
functions : Array[ModuleOpcodeFunction]
scope : String
}pub struct ModuleSizeDiff {
baseline_size : Int
current_size : Int
delta : Int
baseline_code : CodeSizeSummary
current_code : CodeSizeSummary
functions : Array[FunctionSizeChange]
packages : Array[PackageSizeChange]
matching : MatchingSummary
}pub enum Opcode {
Unreachable
Nop
Block
Loop
If
Else
Try
Catch
Throw
Rethrow
ThrowRef
End
Br
BrIf
BrTable
Return
Call
CallIndirect
ReturnCall
ReturnCallIndirect
CallRef
ReturnCallRef
Drop
Select
Delegate
CatchAll
SelectT
LocalGet
LocalSet
LocalTee
GlobalGet
GlobalSet
TableGet
TableSet
I32Load
I64Load
F32Load
F64Load
I32Load8S
I32Load8U
I32Load16S
I32Load16U
I64Load8S
I64Load8U
I64Load16S
I64Load16U
I64Load32S
I64Load32U
I32Store
I64Store
F32Store
F64Store
I32Store8
I32Store16
I64Store8
I64Store16
I64Store32
MemorySize
MemoryGrow
I32Const
I64Const
F32Const
F64Const
I32Eqz
I32Eq
I32Ne
I32LtS
I32LtU
I32GtS
I32GtU
I32LeS
I32LeU
I32GeS
I32GeU
I64Eqz
I64Eq
I64Ne
I64LtS
I64LtU
I64GtS
I64GtU
I64LeS
I64LeU
I64GeS
I64GeU
F32Eq
F32Ne
F32Lt
F32Gt
F32Le
F32Ge
F64Eq
F64Ne
F64Lt
F64Gt
F64Le
F64Ge
I32Clz
I32Ctz
I32Popcnt
I32Add
I32Sub
I32Mul
I32DivS
I32DivU
I32RemS
I32RemU
I32And
I32Or
I32Xor
I32Shl
I32ShrS
I32ShrU
I32Rotl
I32Rotr
I64Clz
I64Ctz
I64Popcnt
I64Add
I64Sub
I64Mul
I64DivS
I64DivU
I64RemS
I64RemU
I64And
I64Or
I64Xor
I64Shl
I64ShrS
I64ShrU
I64Rotl
I64Rotr
F32Abs
F32Neg
F32Ceil
F32Floor
F32Trunc
F32Nearest
F32Sqrt
F32Add
F32Sub
F32Mul
F32Div
F32Min
F32Max
F32Copysign
F64Abs
F64Neg
F64Ceil
F64Floor
F64Trunc
F64Nearest
F64Sqrt
F64Add
F64Sub
F64Mul
F64Div
F64Min
F64Max
F64Copysign
I32WrapI64
I32TruncF32S
I32TruncF32U
I32TruncF64S
I32TruncF64U
I64ExtendI32S
I64ExtendI32U
I64TruncF32S
I64TruncF32U
I64TruncF64S
I64TruncF64U
F32ConvertI32S
F32ConvertI32U
F32ConvertI64S
F32ConvertI64U
F32DemoteF64
F64ConvertI32S
F64ConvertI32U
F64ConvertI64S
F64ConvertI64U
F64PromoteF32
I32ReinterpretF32
I64ReinterpretF64
F32ReinterpretI32
F64ReinterpretI64
I32Extend8S
I32Extend16S
I64Extend8S
I64Extend16S
I64Extend32S
RefNull
RefIsNull
RefFunc
RefEq
RefAsNonNull
BrOnNull
BrOnNonNull
I32TruncSatF32S
I32TruncSatF32U
I32TruncSatF64S
I32TruncSatF64U
I64TruncSatF32S
I64TruncSatF32U
I64TruncSatF64S
I64TruncSatF64U
MemoryInit
DataDrop
MemoryCopy
MemoryFill
TableInit
ElemDrop
TableCopy
TableGrow
TableSize
TableFill
StructNew
StructNewDefault
StructGet
StructGetS
StructGetU
StructSet
ArrayNew
ArrayNewDefault
ArrayNewFixed
ArrayNewData
ArrayNewElem
ArrayGet
ArrayGetS
ArrayGetU
ArraySet
ArrayLen
ArrayFill
ArrayCopy
ArrayInitData
ArrayInitElem
RefTest
RefTestNull
RefCast
RefCastNull
BrOnCast
BrOnCastFail
AnyConvertExtern
ExternConvertAny
RefI31
I31GetS
I31GetU
}pub struct OpcodeSearchFunction {
stat : FunctionStat
match_count : Int
matched_encoded_bytes : Int
sites : Array[FunctionInstructionRecord]
}pub struct OpcodeSearchReport {
file_size : Int
sha256 : String
query : String
matching_rule : String
scope : String
imported_function_count : Int
scanned_local_function_count : Int
matched_function_count : Int
unmatched_function_count : Int
instruction_count : Int
instruction_bytes : Int
match_count : Int
matched_encoded_bytes : Int
other_instruction_bytes : Int
functions : Array[OpcodeSearchFunction]
}pub enum Operands {
None_
BlockType
Label
LabelTable
FunctionIndex
CallIndirect
LocalIndex
GlobalIndex
TableIndex
TagIndex
MemoryIndex
MemoryArg
I32Const
I64Const
F32Const
F64Const
HeapType
RefType
TypeIndex
TypeFieldPair
TypePair
TypeCountPair
TypeDataPair
TypeElemPair
DataIndex
ElemIndex
DataMemoryPair
MemoryPair
ElemTablePair
TablePair
CastPair
TypeVector
}pub struct Options {
path : String
top : Int
retained : Bool
dead_code : Bool
call_graph : String?
html : String?
summary_json : String?
max_size : Int?
baseline : String?
diff_functions : Bool
diff_functions_json : String?
experiment : String?
experiment_context : String?
why_index : Int?
why_root : Int?
why_json : String?
compare_dependencies : (Int, Int)?
compare_dependencies_json : String?
path_between : (Int, Int)?
path_between_json : String?
dependents : Int?
dependents_json : String?
dependents_dot : String?
dependencies : Int?
dependencies_json : String?
dependencies_dot : String?
cycles : Bool
cycle_witness : Bool
cycles_json : String?
callers_index : Int?
callers_json : String?
calls_index : Int?
calls_json : String?
local_accesses_index : Int?
local_accesses_json : String?
find_opcode : String?
find_opcode_json : String?
diff_opcodes : Bool
opcode_stats : Bool
opcode_stats_json : String?
locals_index : Int?
locals_json : String?
baseline_locals_index : Int?
generics : Bool
generics_json : String?
entrypoints : Bool
entrypoints_json : String?
duplicates : Bool
duplicates_json : String?
exports : Bool
diff_exports : Bool
exports_json : String?
metadata : Bool
diff_metadata : Bool
metadata_json : String?
imports : Bool
imports_json : String?
diff_imports : Bool
data_duplicates : Bool
data_duplicates_json : String?
instructions_index : Int?
instructions_json : String?
baseline_instructions_index : Int?
find_functions : String?
find_functions_json : String?
find_data_hex : String?
find_data : String?
find_data_json : String?
baseline_data_preview_index : Int?
baseline_data_offset : Int?
data_preview_index : Int?
data_offset : Int?
data_limit : Int?
data_preview_json : String?
locate_range_offset : Int?
locate_range_length : Int?
locate_range_json : String?
locate_offset : Int?
locate_offset_json : String?
locate_decode : Bool
budget : String?
budget_json : String?
budget_md : String?
compress : Bool
data_segments : Bool
data_json : String?
diff_data : Bool
strict : Bool
}pub struct PackageSizeChange {
name : String
baseline_functions : Int
current_functions : Int
baseline_size : Int
current_size : Int
delta : Int
}pub struct PathLimits {
max_nodes : Int
max_edges : Int
max_depth : Int
}pub struct PathSearchStats {
root_sources : Int
prepared_roots : Int
indexed_edges : Int
visited_nodes : Int
checked_edges : Int
max_depth : Int
phase : String
limit_reason : String?
}pub struct Reader {
data : Bytes
start : Int
end : Int
pos : Int
}pub struct RetainedSize {
index : Int
own_size : Int
retained : Int
retained_functions : Int
}pub struct Section {
id : Int
kind : SectionId
offset : Int
payload_size : Int
total_size : Int
custom_name : String?
}pub enum SectionId {
Custom
Type
Import
Function
Table
Memory
Global
Export
Start
Element
Code
Data
DataCount
Tag
}pub struct TableType {
element_type : Int
minimum : Int
maximum : Int?
}pub enum WasmError {
UnexpectedEnd(Int, Int)
BadMagic
InvalidSectionId(Int)
LebOverflow(Int)
InvalidReadRange(Int, Int, Int, Int)
ValueOutOfRange(Int, UInt)
UnsupportedVersion(Int, UInt)
DuplicateSection(Int, SectionId)
InvalidSectionOrder(Int, SectionId, SectionId)
FunctionCodeCountMismatch(Int, SectionId, Int, Int)
TrailingSectionBytes(Int, SectionId)
InvalidTableEncoding(Int, String)
InvalidDataEncoding(Int, String)
InvalidImportKind(Int)
InvalidImportEncoding(Int, String)
InvalidExportEncoding(Int, String)
UnknownOpcode(Int, Int)
UnknownPrefixedOpcode(Int, Int, Int)
}let EXIT_OVER_SIZE : Intfn collect_function_stats(parsed : WasmModule, data : Bytes) -> Result[Array[FunctionStat], WasmError]fn compare_data_previews(baseline_data : Bytes, baseline_index : Int, baseline_offset : Int, current_data : Bytes, current_index : Int, current_offset : Int, limit : Int) -> Result[DataPreviewComparison, DataPreviewComparisonError]fn compare_data_segments(baseline : Bytes, current : Bytes) -> Result[DataSegmentsComparison, ComparisonError]fn compare_function_dependencies(data : Bytes, left_index : Int, right_index : Int) -> Result[DependencyOverlapReport, DependencyOverlapError]fn compare_function_instructions(baseline : Bytes, baseline_index : Int, current : Bytes, current_index : Int) -> Result[FunctionInstructionsComparison, FunctionInstructionsComparisonError]fn compare_function_locals(baseline_data : Bytes, baseline_index : Int, current_data : Bytes, current_index : Int) -> Result[FunctionLocalsComparison, FunctionLocalsComparisonError]fn compare_imports(baseline : Bytes, current : Bytes) -> Result[ImportsComparison, ImportsComparisonError]fn compare_metadata(baseline : Bytes, current : Bytes) -> Result[MetadataComparison, ComparisonError]fn compare_module_opcodes(baseline_data : Bytes, current_data : Bytes) -> Result[ModuleOpcodeComparison, ModuleOpcodeComparisonError]fn compare_modules(baseline_data : Bytes, current_data : Bytes) -> Result[ModuleSizeDiff, ComparisonError]fn decode_instructions(bytes : Bytes, body_offset : Int, body_size : Int) -> Result[Array[Instruction], WasmError]fn demangle_full(symbol : String) -> Stringfn describe_function_instructions_comparison_error(error : FunctionInstructionsComparisonError) -> Stringfn display_name(name : String) -> Stringfn evaluate_budget(budget : CompiledBudget, current_data : Bytes, baseline_data? : Bytes) -> Result[BudgetReport, BudgetError]fn explain_function(data : Bytes, target_index : Int, root? : Int, limits? : PathLimits) -> Result[FunctionPathReport, FunctionPathError]fn function_callers(data : Bytes, target_index : Int) -> Result[FunctionCallersReport, FunctionCallersError]fn function_cycle_witnesses(data : Bytes) -> Result[FunctionCycleWitnessReport, FunctionCycleWitnessError]fn function_dependencies(data : Bytes, target_index : Int) -> Result[FunctionDependenciesReport, FunctionDependenciesError]fn function_dependents(data : Bytes, target_index : Int) -> Result[FunctionDependentsReport, FunctionDependentsError]fn function_path_between(data : Bytes, source_index : Int, target_index : Int) -> Result[FunctionPathBetweenReport, FunctionPathBetweenError]fn inspect_function_calls(data : Bytes, index : Int) -> Result[FunctionCallsReport, FunctionCallsError]fn inspect_function_instructions(data : Bytes, index : Int) -> Result[FunctionInstructionsReport, FunctionInstructionsError]fn inspect_function_local_accesses(data : Bytes, index : Int) -> Result[FunctionLocalAccessesReport, FunctionLocalAccessesError]fn inspect_function_locals(data : Bytes, index : Int) -> Result[FunctionLocalsReport, FunctionLocalsError]fn locate_file_offset_decoded(data : Bytes, offset : Int) -> Result[FileOffsetDecodedReport, FileOffsetDecodeError]fn locate_file_range(data : Bytes, offset : Int, length : Int) -> Result[FileRangeReport, FileRangeError]fn module_of(name : String) -> Stringfn parse_code_section(data : Bytes, section : Section, base_index? : Int) -> Result[Array[FunctionBody], WasmError]fn parse_count(text : String) -> Int?fn parse_element_section(data : Bytes, section : Section) -> Result[Array[ElementSegment], WasmError]fn parse_size(text : String) -> Int?fn preview_data_segment(data : Bytes, index : Int, offset : Int, limit : Int) -> Result[DataPreviewReport, DataPreviewError]fn render_budget_json(report : BudgetReport, current_path : String, baseline_path? : String) -> Stringfn render_budget_markdown(report : BudgetReport, current_path : String, baseline_path? : String) -> Stringfn render_compression(raw_size : Int, gzip : Result[Int, String], sections : Array[SectionCompression]) -> Stringfn render_data_segments_diff(report : DataSegmentsComparison, baseline_path : String, current_path : String, top : Int) -> Stringfn render_data_segments_diff_json(report : DataSegmentsComparison, baseline_path : String, current_path : String) -> Stringfn render_function_diff_json(diff : ModuleSizeDiff, baseline_sha256 : String, current_sha256 : String) -> Stringfn render_html_with_data_segments(analysis : Analysis, file_path : String, report : DataSegmentsReport, echarts? : String) -> Stringfn render_json(path : String, stats : Array[FunctionStat], graph : CallGraph, roots : Set[Int], reachable : Set[Int], retained : Array[RetainedSize]) -> Stringfn retained_sizes(graph : CallGraph, sizes : Map[Int, Int], roots : Set[Int]) -> Array[RetainedSize]fn search_data_segments_hex(data : Bytes, query_hex : String) -> Result[DataHexSearchReport, DataHexSearchError]fn search_local_functions(data : Bytes, query : String) -> Result[FunctionSearchReport, FunctionSearchError]fn usage() -> StringInstall
Download zipA Wasm size profiler for MoonBit — section breakdown, function ranking, call graph and retained-size analysis