Skip to content

dcepass: clone floating-point constants without precision loss - #2516

Merged
cpunion merged 1 commit into
xgo-dev:mainfrom
zhouguangyuan0718:codex/fp-constant-bits
Sep 11, 2026
Merged

cpunion merged 1 commit into
xgo-dev:mainfrom
zhouguangyuan0718:codex/fp-constant-bits

Conversation

@zhouguangyuan0718

@zhouguangyuan0718 zhouguangyuan0718 commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

The DCE override emitter reconstructs floating-point constants in a new LLVM context by converting them through float64. This silently rounds x86_fp80/fp128 values, drops wide NaN payload bits, and loses the trailing double in ppc_fp128 constants. Clone their raw APFloat representation using FloatBits and ConstFloatFromBits instead.

The regression parses independent source IR and checks scalar and nested-struct copies after disposing the source module and context. It covers negative zero, signaling/quiet NaNs, subnormal/infinity, extended precision, and ppc double-double encodings. The precision/payload cases fail with the old implementation and pass with this change.

Use the published github.com/xgo-dev/llvm v0.10.0, which includes the merged binding PR #54, and remove the temporary personal-fork replacement and checksums. LLVM 22 uses LLVMConstFPFromBits; the binding provides the APFloat fallback for older LLVM versions. All native glue remains in the binding repository.

Validation after updating to main 1e41ad3ff7, on macOS arm64 with Go 1.27.0 and matching LLVM/clang/LLD 22.1.8:

  • Full go test ./internal/dcepass ./internal/build -count=1 passed with the published dependency, including DCE build integration and Wasm source-patch type checks. Go 1.27.0 was located outside GOMODCACHE so its source files can be used by Go overlays.
  • go mod tidy, go mod verify, and git diff --check passed. The v0.10.0 tag resolves to the merge of binding llgo run: strlen #54, ba7259f57dac75fad1a406bf2d9ae51b154a7b20.

This corrects the general constant-cloning path; the reproducer does not establish that ordinary Go-generated ABI metadata currently includes these wide constants. Remote CI for the updated head remains pending.

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: preserve raw FP bits in dcepass constant cloning

The core fix is correct and well-targeted. The old code round-tripped every floating-point constant through float64 via DoubleValue(), silently corrupting values that float64 cannot represent exactly — x86_fp80, fp128, ppc_fp128, NaN payloads, signaling-NaN bits, and subnormals. Switching to ConstFloatFromBits(dstTy, v.FloatBits()) copies the raw APFloat representation and is the right approach.

The new test is thorough: it uses parsed IR (so construction is independent of the cloning being tested), covers exactly the cases the old path broke, and exercises both the direct and the struct-nested recursive clone paths, ending with VerifyModule. Performance impact is negligible (one extra cgo call + a tiny slice alloc on a cold branch), and the cgo bit-passing path is memory-safe (the fork validates type/word-count/high-bits before reading). Documentation and in-test comments are accurate.

One blocking concern: the go.mod replace directive points a build-critical dependency at a personal fork pinned to an untagged commit (see inline). This should not land in mainline as-is.

Comment thread go.mod Outdated

replace github.com/xgo-dev/llgo/runtime => ./runtime

replace github.com/xgo-dev/llvm => github.com/zhouguangyuan0718/go-llvm v0.0.0-20260906104539-311bf7ae7fc6

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: this redirects the build-critical LLVM binding from the org-owned github.com/xgo-dev/llvm to a personal fork (github.com/zhouguangyuan0718/go-llvm) pinned to an untagged pseudo-version. This makes the fix non-self-contained (ConstFloatFromBits/FloatBits don't exist in the still-required xgo-dev/llvm v0.9.9, so the build only compiles because of this redirect) and is a supply-chain / reproducibility risk: a personal namespace can be renamed, deleted, or force-pushed outside org control.

Note the go.sum coincidence where the fork's go.mod h1 hash equals xgo-dev/llvm v0.9.9's (42vav2/...) — that only means the manifest is byte-identical; the module content hash differs, so the matching go.mod hash should not be read as parity.

Recommendation: land the FloatBits/ConstFloatFromBits API upstream in xgo-dev/llvm, bump the require to that tagged release, and drop this replace before merge. If a temporary pin is truly needed, point it at an xgo-dev-owned ref rather than an individual account.

name := global.Name()
if nested {
name += "_nested"
value = srcCtx.ConstStruct([]llvm.Value{value}, false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: value is declared in the outer loop and reassigned here (value = srcCtx.ConstStruct(...)) inside the inner nested loop. It's correct — value is re-read from global.Initializer() at the top of each outer iteration, so the struct wrapping doesn't compound across globals — but it's subtle. Consider a distinct local (e.g. nested := srcCtx.ConstStruct([]llvm.Value{value}, false)) to make the non-compounding behavior obvious at a glance.

@codecov

codecov Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

LLGo baseline benchmarks

2f1b6ab7fce9 | workflow run | long-term charts

Program measurements

Platform Workload File size vs base Text size vs base Build vs base Run vs base
Linux cprintf 19848 B 0 B / +0.0% 387 B 0 B / +0.0% 918.380 ms +20.18 ms / +2.2% (worse) 2.034 ms -114.5 us / -5.3% (better)
Linux cprintf-lto 19600 B 0 B / +0.0% 368 B 0 B / +0.0% 877.190 ms -27.98 ms / -3.1% (better) 2.173 ms +55.44 us / +2.6% (worse)
Linux fmtprintf 1617304 B +8 B / +0.0004947% (worse) 492562 B 0 B / +0.0% 6.977 s -120.2 ms / -1.7% (better) 5.702 ms -65.65 us / -1.1% (better)
Linux fmtprintf-lto 1467792 B 0 B / +0.0% 434301 B 0 B / +0.0% 18.581 s -327 ms / -1.7% (better) 5.804 ms +570 us / +10.9% (worse)
Linux println 62752 B 0 B / +0.0% 15039 B 0 B / +0.0% 900.336 ms -1.66 ms / -0.2% (better) 2.625 ms -134.6 us / -4.9% (better)
Linux println-lto 54312 B 0 B / +0.0% 12431 B 0 B / +0.0% 1.246 s -19.84 ms / -1.6% (better) 2.749 ms +104.1 us / +3.9% (worse)
macOS cprintf 84480 B 0 B / +0.0% 17117 B 0 B / +0.0% 856.721 ms +118.6 ms / +16.1% (worse) 4.422 ms +205.9 us / +4.9% (worse)
macOS cprintf-lto 84288 B 0 B / +0.0% 12881 B 0 B / +0.0% 850.188 ms +61.17 ms / +7.8% (worse) 10.567 ms +7.286 ms / +222.0% (worse)
macOS fmtprintf 1473744 B 0 B / +0.0% 867044 B 0 B / +0.0% 4.348 s +488.4 ms / +12.7% (worse) 6.619 ms -1.09 ms / -14.1% (better)
macOS fmtprintf-lto 1159552 B 0 B / +0.0% 840436 B 0 B / +0.0% 11.250 s +95.89 ms / +0.9% (worse) 6.596 ms -274.1 us / -4.0% (better)
macOS println 114864 B 0 B / +0.0% 35069 B 0 B / +0.0% 742.663 ms +14.21 ms / +2.0% (worse) 4.814 ms +1.341 ms / +38.6% (worse)
macOS println-lto 118736 B 0 B / +0.0% 32729 B 0 B / +0.0% 1.030 s -78.07 ms / -7.0% (better) 4.630 ms +285.6 us / +6.6% (worse)
Windows MinGW cprintf 19456 B 0 B / +0.0% 4550 B 0 B / +0.0% 1.168 s +52.01 ms / +4.7% (worse) 4.388 ms +910.5 us / +26.2% (worse)
Windows MinGW cprintf-lto 17920 B 0 B / +0.0% 4486 B 0 B / +0.0% 1.164 s +12.71 ms / +1.1% (worse) 3.867 ms +419.7 us / +12.2% (worse)
Windows MinGW fmtprintf 1886720 B 0 B / +0.0% 593350 B 0 B / +0.0% 3.974 s +16.44 ms / +0.4% (worse) 7.962 ms -154.1 us / -1.9% (better)
Windows MinGW fmtprintf-lto 1927680 B 0 B / +0.0% 541606 B 0 B / +0.0% 9.817 s -47.91 ms / -0.5% (better) 8.191 ms -592.5 us / -6.7% (better)
Windows MinGW println 71680 B 0 B / +0.0% 23974 B 0 B / +0.0% 1.127 s +8.074 ms / +0.7% (worse) 6.883 ms +677.7 us / +10.9% (worse)
Windows MinGW println-lto 65536 B 0 B / +0.0% 20726 B 0 B / +0.0% 1.333 s +9.943 ms / +0.8% (worse) 6.657 ms +210 us / +3.3% (worse)
Windows MinGW 386 cprintf 37888 B 0 B / +0.0% 5326 B 0 B / +0.0% 1.128 s +3.604 ms / +0.3% (worse) 5.270 ms +105.1 us / +2.0% (worse)
Windows MinGW 386 cprintf-lto 20992 B 0 B / +0.0% 5094 B 0 B / +0.0% 1.185 s +16.63 ms / +1.4% (worse) 5.110 ms -35.8 us / -0.7% (better)
Windows MinGW 386 fmtprintf 1843712 B 0 B / +0.0% 467434 B 0 B / +0.0% 4.177 s -20.17 ms / -0.5% (better) 11.818 ms +785.9 us / +7.1% (worse)
Windows MinGW 386 fmtprintf-lto 2163712 B 0 B / +0.0% 447162 B 0 B / +0.0% 9.646 s +23.44 ms / +0.2% (worse) 12.024 ms +1.026 ms / +9.3% (worse)
Windows MinGW 386 println 86528 B 0 B / +0.0% 20374 B 0 B / +0.0% 1.147 s +18.92 ms / +1.7% (worse) 9.789 ms +1.009 ms / +11.5% (worse)
Windows MinGW 386 println-lto 70656 B 0 B / +0.0% 18262 B 0 B / +0.0% 1.361 s +27.35 ms / +2.1% (worse) 9.021 ms -533.1 us / -5.6% (better)
Windows MinGW ARM64 cprintf 18944 B 0 B / +0.0% 4436 B 0 B / +0.0% 1.534 s -12.35 ms / -0.8% (better) 7.226 ms -411.8 us / -5.4% (better)
Windows MinGW ARM64 cprintf-lto 17920 B 0 B / +0.0% 4368 B 0 B / +0.0% 1.568 s +97.4 us / +0.006211% (worse) 7.051 ms +62.8 us / +0.9% (worse)
Windows MinGW ARM64 fmtprintf 1775104 B 0 B / +0.0% 506200 B 0 B / +0.0% 4.409 s -33.48 ms / -0.8% (better) 13.713 ms -11.4 us / -0.1% (better)
Windows MinGW ARM64 fmtprintf-lto 1855488 B 0 B / +0.0% 473204 B 0 B / +0.0% 10.216 s -40.6 ms / -0.4% (better) 14.051 ms -931 us / -6.2% (better)
Windows MinGW ARM64 println 68608 B 0 B / +0.0% 22880 B 0 B / +0.0% 1.537 s -4.324 ms / -0.3% (better) 12.081 ms -500.4 us / -4.0% (better)
Windows MinGW ARM64 println-lto 65024 B 0 B / +0.0% 20160 B 0 B / +0.0% 1.727 s -28.91 ms / -1.6% (better) 12.001 ms -402.4 us / -3.2% (better)
Windows MSVC cprintf 120320 B 0 B / +0.0% 65782 B 0 B / +0.0% 897.110 ms -9.153 ms / -1.0% (better) 3.298 ms -47.7 us / -1.4% (better)
Windows MSVC cprintf-lto 119808 B 0 B / +0.0% 65718 B 0 B / +0.0% 923.528 ms +3.874 ms / +0.4% (worse) 3.426 ms +302.2 us / +9.7% (worse)
Windows MSVC fmtprintf 1616896 B 0 B / +0.0% 688870 B 0 B / +0.0% 3.644 s +51.58 ms / +1.4% (worse) 9.148 ms +231.5 us / +2.6% (worse)
Windows MSVC fmtprintf-lto 1615872 B 0 B / +0.0% 644326 B 0 B / +0.0% 8.617 s -5.821 ms / -0.1% (better) 9.972 ms +1.14 ms / +12.9% (worse)
Windows MSVC println 193024 B 0 B / +0.0% 119382 B 0 B / +0.0% 897.272 ms +554 us / +0.1% (worse) 6.768 ms -208.8 us / -3.0% (better)
Windows MSVC println-lto 189952 B 0 B / +0.0% 116678 B 0 B / +0.0% 1.079 s +3.916 ms / +0.4% (worse) 6.630 ms -79.1 us / -1.2% (better)
Windows MSVC 386 cprintf 9728 B 0 B / +0.0% 3931 B 0 B / +0.0% 1.012 s +23.09 ms / +2.3% (worse) 6.194 ms +293.1 us / +5.0% (worse)
Windows MSVC 386 cprintf-lto 9216 B 0 B / +0.0% 3853 B 0 B / +0.0% 998.079 ms -12 ms / -1.2% (better) 5.787 ms -29.6 us / -0.5% (better)
Windows MSVC 386 fmtprintf 1186304 B 0 B / +0.0% 450801 B 0 B / +0.0% 3.901 s +9.689 ms / +0.2% (worse) 13.454 ms -152.1 us / -1.1% (better)
Windows MSVC 386 fmtprintf-lto 1228288 B 0 B / +0.0% 426629 B 0 B / +0.0% 9.038 s -146.4 ms / -1.6% (better) 12.863 ms -384.9 us / -2.9% (better)
Windows MSVC 386 println 34816 B 0 B / +0.0% 19233 B 0 B / +0.0% 1.015 s -122.7 ms / -10.8% (better) 10.692 ms -1.395 ms / -11.5% (better)
Windows MSVC 386 println-lto 32768 B 0 B / +0.0% 17351 B 0 B / +0.0% 1.191 s +20.71 ms / +1.8% (worse) 9.798 ms -929.9 us / -8.7% (better)
Windows MSVC ARM64 cprintf 11264 B 0 B / +0.0% 3976 B 0 B / +0.0% 2.108 s -969.8 us / -0.04599% (better) 7.219 ms -248.5 us / -3.3% (better)
Windows MSVC ARM64 cprintf-lto 10752 B 0 B / +0.0% 3868 B 0 B / +0.0% 2.092 s -29.48 ms / -1.4% (better) 6.940 ms -597.1 us / -7.9% (better)
Windows MSVC ARM64 fmtprintf 1363456 B 0 B / +0.0% 505740 B 0 B / +0.0% 6.760 s +215.4 ms / +3.3% (worse) 16.323 ms -500.8 us / -3.0% (better)
Windows MSVC ARM64 fmtprintf-lto 1386496 B 0 B / +0.0% 473916 B 0 B / +0.0% 16.523 s +64.82 ms / +0.4% (worse) 16.058 ms +1.494 ms / +10.3% (worse)
Windows MSVC ARM64 println 41984 B 0 B / +0.0% 22216 B 0 B / +0.0% 2.034 s -61.81 ms / -2.9% (better) 12.500 ms -1.161 ms / -8.5% (better)
Windows MSVC ARM64 println-lto 40448 B 0 B / +0.0% 20044 B 0 B / +0.0% 2.374 s -71.84 ms / -2.9% (better) 12.393 ms -2.094 ms / -14.5% (better)
Core language and compiler benchmarks
Platform Benchmark ns/op vs base
Linux BenchmarkLookupPCRandom 43.920 ns/op +0.86 ns/op / +2.0% (worse)
Linux BenchmarkMergeCompilerFlags 457.700 ns/op -18.6 ns/op / -3.9% (better)
Linux BenchmarkMergeLinkerFlags 310.200 ns/op -16.4 ns/op / -5.0% (better)
Linux BenchmarkChannelBuffered 162.700 ns/op -0.8 ns/op / -0.5% (better)
Linux BenchmarkChannelHandoff 26751 ns/op +4641 ns/op / +21.0% (worse)
Linux BenchmarkDefer 154.300 ns/op -0.3 ns/op / -0.2% (better)
Linux BenchmarkDirectCall 4.310 ns/op +0.085 ns/op / +2.0% (worse)
Linux BenchmarkGlobalRead 5.117 ns/op -0.042 ns/op / -0.8% (better)
Linux BenchmarkGlobalWrite 6.945 ns/op +0.012 ns/op / +0.2% (worse)
Linux BenchmarkGoroutine 36348 ns/op -12701 ns/op / -25.9% (better)
Linux BenchmarkInterfaceCall 30.970 ns/op +3.18 ns/op / +11.4% (worse)
Linux BenchmarkRuntimeGetG 5.859 ns/op +0.12 ns/op / +2.1% (worse)
macOS BenchmarkLookupPCRandom 17.770 ns/op +0.81 ns/op / +4.8% (worse)
macOS BenchmarkMergeCompilerFlags 157.300 ns/op -1 ns/op / -0.6% (better)
macOS BenchmarkMergeLinkerFlags 105.500 ns/op +9.85 ns/op / +10.3% (worse)
macOS BenchmarkChannelBuffered 32.080 ns/op -5.33 ns/op / -14.2% (better)
macOS BenchmarkChannelHandoff 8654 ns/op +116 ns/op / +1.4% (worse)
macOS BenchmarkDefer 51.590 ns/op +3.46 ns/op / +7.2% (worse)
macOS BenchmarkDirectCall 1.270 ns/op -0.012 ns/op / -0.9% (better)
macOS BenchmarkGlobalRead 1.196 ns/op -0.302 ns/op / -20.2% (better)
macOS BenchmarkGlobalWrite 1.247 ns/op -0.385 ns/op / -23.6% (better)
macOS BenchmarkGoroutine 47888 ns/op +11336 ns/op / +31.0% (worse)
macOS BenchmarkInterfaceCall 7.215 ns/op +1.145 ns/op / +18.9% (worse)
macOS BenchmarkRuntimeGetG 2.282 ns/op -0.731 ns/op / -24.3% (better)
Windows MinGW BenchmarkLookupPCRandom 13.170 ns/op +0.09 ns/op / +0.7% (worse)
Windows MinGW BenchmarkMergeCompilerFlags 628 ns/op -8.4 ns/op / -1.3% (better)
Windows MinGW BenchmarkMergeLinkerFlags 565.200 ns/op -11.8 ns/op / -2.0% (better)
Windows MinGW BenchmarkChannelBuffered 37.430 ns/op +0.22 ns/op / +0.6% (worse)
Windows MinGW BenchmarkChannelHandoff 981.400 ns/op +3.2 ns/op / +0.3% (worse)
Windows MinGW BenchmarkDefer 56.720 ns/op -0.87 ns/op / -1.5% (better)
Windows MinGW BenchmarkDirectCall 1.549 ns/op 0 ns/op / +0.0%
Windows MinGW BenchmarkGlobalRead 1.859 ns/op +0.002 ns/op / +0.1% (worse)
Windows MinGW BenchmarkGlobalWrite 2.436 ns/op -0.009 ns/op / -0.4% (better)
Windows MinGW BenchmarkGoroutine 79106 ns/op -7268 ns/op / -8.4% (better)
Windows MinGW BenchmarkInterfaceCall 8.696 ns/op -0.007 ns/op / -0.1% (better)
Windows MinGW BenchmarkRuntimeGetG 2.178 ns/op +0.01 ns/op / +0.5% (worse)
Windows MinGW 386 BenchmarkLookupPCRandom 26.570 ns/op 0 ns/op / +0.0%
Windows MinGW 386 BenchmarkMergeCompilerFlags 755.800 ns/op +46.2 ns/op / +6.5% (worse)
Windows MinGW 386 BenchmarkMergeLinkerFlags 677.300 ns/op +18 ns/op / +2.7% (worse)
Windows MinGW 386 BenchmarkChannelBuffered 42.320 ns/op -0.47 ns/op / -1.1% (better)
Windows MinGW 386 BenchmarkChannelHandoff 946.100 ns/op -54.9 ns/op / -5.5% (better)
Windows MinGW 386 BenchmarkDefer 43.430 ns/op +1.28 ns/op / +3.0% (worse)
Windows MinGW 386 BenchmarkDirectCall 1.856 ns/op -0.001 ns/op / -0.1% (better)
Windows MinGW 386 BenchmarkGlobalRead 1.864 ns/op +0.004 ns/op / +0.2% (worse)
Windows MinGW 386 BenchmarkGlobalWrite 7.779 ns/op -0.006 ns/op / -0.1% (better)
Windows MinGW 386 BenchmarkGoroutine 88691 ns/op -453 ns/op / -0.5% (better)
Windows MinGW 386 BenchmarkInterfaceCall 9.608 ns/op +0.004 ns/op / +0.04165% (worse)
Windows MinGW 386 BenchmarkRuntimeGetG 2.171 ns/op -0.005 ns/op / -0.2% (better)
Windows MinGW ARM64 BenchmarkLookupPCRandom 12.020 ns/op -0.04 ns/op / -0.3% (better)
Windows MinGW ARM64 BenchmarkMergeCompilerFlags 576.300 ns/op +4.5 ns/op / +0.8% (worse)
Windows MinGW ARM64 BenchmarkMergeLinkerFlags 544.400 ns/op +2.4 ns/op / +0.4% (worse)
Windows MinGW ARM64 BenchmarkChannelBuffered 43.820 ns/op -0.03 ns/op / -0.1% (better)
Windows MinGW ARM64 BenchmarkChannelHandoff 2455 ns/op -251 ns/op / -9.3% (better)
Windows MinGW ARM64 BenchmarkDefer 59.630 ns/op +2.23 ns/op / +3.9% (worse)
Windows MinGW ARM64 BenchmarkDirectCall 0.590 ns/op +0.0004 ns/op / +0.1% (worse)
Windows MinGW ARM64 BenchmarkGlobalRead 0.663 ns/op -0.0001 ns/op / -0.01507% (better)
Windows MinGW ARM64 BenchmarkGlobalWrite 0.738 ns/op -0.0001 ns/op / -0.01356% (better)
Windows MinGW ARM64 BenchmarkGoroutine 65779 ns/op +3445 ns/op / +5.5% (worse)
Windows MinGW ARM64 BenchmarkInterfaceCall 4.718 ns/op +0.004 ns/op / +0.1% (worse)
Windows MinGW ARM64 BenchmarkRuntimeGetG 1.806 ns/op +0.002 ns/op / +0.1% (worse)
Windows MSVC BenchmarkLookupPCRandom 12.990 ns/op -0.11 ns/op / -0.8% (better)
Windows MSVC BenchmarkMergeCompilerFlags 619.400 ns/op +10.5 ns/op / +1.7% (worse)
Windows MSVC BenchmarkMergeLinkerFlags 539.100 ns/op +16.8 ns/op / +3.2% (worse)
Windows MSVC BenchmarkChannelBuffered 36.550 ns/op 0 ns/op / +0.0%
Windows MSVC BenchmarkChannelHandoff 1257 ns/op +8 ns/op / +0.6% (worse)
Windows MSVC BenchmarkDefer 53.870 ns/op +0.58 ns/op / +1.1% (worse)
Windows MSVC BenchmarkDirectCall 1.547 ns/op -0.002 ns/op / -0.1% (better)
Windows MSVC BenchmarkGlobalRead 1.858 ns/op +0.001 ns/op / +0.1% (worse)
Windows MSVC BenchmarkGlobalWrite 2.473 ns/op +0.002 ns/op / +0.1% (worse)
Windows MSVC BenchmarkGoroutine 80406 ns/op -58 ns/op / -0.1% (better)
Windows MSVC BenchmarkInterfaceCall 9.308 ns/op +0.013 ns/op / +0.1% (worse)
Windows MSVC BenchmarkRuntimeGetG 2.167 ns/op -0.002 ns/op / -0.1% (better)
Windows MSVC 386 BenchmarkLookupPCRandom 26.550 ns/op +0.04 ns/op / +0.2% (worse)
Windows MSVC 386 BenchmarkMergeCompilerFlags 769.800 ns/op +17 ns/op / +2.3% (worse)
Windows MSVC 386 BenchmarkMergeLinkerFlags 695.800 ns/op +6.5 ns/op / +0.9% (worse)
Windows MSVC 386 BenchmarkChannelBuffered 43.970 ns/op -0.92 ns/op / -2.0% (better)
Windows MSVC 386 BenchmarkChannelHandoff 947.900 ns/op +6.8 ns/op / +0.7% (worse)
Windows MSVC 386 BenchmarkDefer 46.120 ns/op -2.7 ns/op / -5.5% (better)
Windows MSVC 386 BenchmarkDirectCall 1.548 ns/op -0.001 ns/op / -0.1% (better)
Windows MSVC 386 BenchmarkGlobalRead 1.550 ns/op +0.001 ns/op / +0.1% (worse)
Windows MSVC 386 BenchmarkGlobalWrite 7.781 ns/op -0.012 ns/op / -0.2% (better)
Windows MSVC 386 BenchmarkGoroutine 88795 ns/op -431 ns/op / -0.5% (better)
Windows MSVC 386 BenchmarkInterfaceCall 9.604 ns/op -0.031 ns/op / -0.3% (better)
Windows MSVC 386 BenchmarkRuntimeGetG 1.931 ns/op +0.002 ns/op / +0.1% (worse)
Windows MSVC ARM64 BenchmarkLookupPCRandom 12.130 ns/op +0.09 ns/op / +0.7% (worse)
Windows MSVC ARM64 BenchmarkMergeCompilerFlags 567.600 ns/op -3 ns/op / -0.5% (better)
Windows MSVC ARM64 BenchmarkMergeLinkerFlags 536.900 ns/op -3 ns/op / -0.6% (better)
Windows MSVC ARM64 BenchmarkChannelBuffered 44.030 ns/op -3.12 ns/op / -6.6% (better)
Windows MSVC ARM64 BenchmarkChannelHandoff 3549 ns/op +168 ns/op / +5.0% (worse)
Windows MSVC ARM64 BenchmarkDefer 66.800 ns/op +4.01 ns/op / +6.4% (worse)
Windows MSVC ARM64 BenchmarkDirectCall 0.589 ns/op -0.0004 ns/op / -0.1% (better)
Windows MSVC ARM64 BenchmarkGlobalRead 0.664 ns/op +0.0001 ns/op / +0.01507% (worse)
Windows MSVC ARM64 BenchmarkGlobalWrite 3.754 ns/op +0.001 ns/op / +0.02665% (worse)
Windows MSVC ARM64 BenchmarkGoroutine 56530 ns/op +1303 ns/op / +2.4% (worse)
Windows MSVC ARM64 BenchmarkInterfaceCall 4.715 ns/op -0.004 ns/op / -0.1% (better)
Windows MSVC ARM64 BenchmarkRuntimeGetG 1.774 ns/op -0.024 ns/op / -1.3% (better)

Timer runtime benchmarks

Platform Operation and runtime ns/op vs base
Linux AfterFuncZeroDelivery/Go 1540 ns/op +2 ns/op / +0.1% (worse)
Linux AfterFuncZeroDelivery/LLGo 58679 ns/op -4729 ns/op / -7.5% (better)
Linux CreateStop/Go 394.400 ns/op +0.8 ns/op / +0.2% (worse)
Linux CreateStop/LLGo 3001 ns/op +28 ns/op / +0.9% (worse)
Linux RearmStopped/Go 139.400 ns/op -4.1 ns/op / -2.9% (better)
Linux RearmStopped/LLGo 2886 ns/op +312 ns/op / +12.1% (worse)
Linux ResetActive/Go 97.520 ns/op -0.39 ns/op / -0.4% (better)
Linux ResetActive/LLGo 1701 ns/op -112 ns/op / -6.2% (better)
Linux ResetHeap1024/Go 97.270 ns/op +0.24 ns/op / +0.2% (worse)
Linux ResetHeap1024/LLGo 434.700 ns/op -3.4 ns/op / -0.8% (better)
macOS AfterFuncZeroDelivery/Go 608.600 ns/op +24.5 ns/op / +4.2% (worse)
macOS AfterFuncZeroDelivery/LLGo 112218 ns/op +13942 ns/op / +14.2% (worse)
macOS CreateStop/Go 204.300 ns/op +12.3 ns/op / +6.4% (worse)
macOS CreateStop/LLGo 899 ns/op +43.3 ns/op / +5.1% (worse)
macOS RearmStopped/Go 78.620 ns/op +6.83 ns/op / +9.5% (worse)
macOS RearmStopped/LLGo 502.700 ns/op +94.5 ns/op / +23.2% (worse)
macOS ResetActive/Go 54.570 ns/op +2.74 ns/op / +5.3% (worse)
macOS ResetActive/LLGo 157.200 ns/op +3.7 ns/op / +2.4% (worse)
macOS ResetHeap1024/Go 56.760 ns/op +5.34 ns/op / +10.4% (worse)
macOS ResetHeap1024/LLGo 112.300 ns/op -3.1 ns/op / -2.7% (better)
Windows MinGW AfterFuncZeroDelivery/Go 567.900 ns/op +12.5 ns/op / +2.3% (worse)
Windows MinGW AfterFuncZeroDelivery/LLGo 166330 ns/op +1144 ns/op / +0.7% (worse)
Windows MinGW CreateStop/Go 115.200 ns/op -7.1 ns/op / -5.8% (better)
Windows MinGW CreateStop/LLGo 488.100 ns/op +12.4 ns/op / +2.6% (worse)
Windows MinGW RearmStopped/Go 31.500 ns/op -0.02 ns/op / -0.1% (better)
Windows MinGW RearmStopped/LLGo 313 ns/op +9.8 ns/op / +3.2% (worse)
Windows MinGW ResetActive/Go 20.100 ns/op -0.06 ns/op / -0.3% (better)
Windows MinGW ResetActive/LLGo 174.400 ns/op +15.8 ns/op / +10.0% (worse)
Windows MinGW ResetHeap1024/Go 20.410 ns/op -0.01 ns/op / -0.04897% (better)
Windows MinGW ResetHeap1024/LLGo 142 ns/op +1.3 ns/op / +0.9% (worse)
Windows MinGW 386 AfterFuncZeroDelivery/Go 962.200 ns/op -11.1 ns/op / -1.1% (better)
Windows MinGW 386 AfterFuncZeroDelivery/LLGo 192017 ns/op -2379 ns/op / -1.2% (better)
Windows MinGW 386 CreateStop/Go 190.400 ns/op -0.7 ns/op / -0.4% (better)
Windows MinGW 386 CreateStop/LLGo 2181 ns/op -112 ns/op / -4.9% (better)
Windows MinGW 386 RearmStopped/Go 63.340 ns/op -0.16 ns/op / -0.3% (better)
Windows MinGW 386 RearmStopped/LLGo 367.500 ns/op -8.7 ns/op / -2.3% (better)
Windows MinGW 386 ResetActive/Go 39.110 ns/op +0.09 ns/op / +0.2% (worse)
Windows MinGW 386 ResetActive/LLGo 985 ns/op +14.5 ns/op / +1.5% (worse)
Windows MinGW 386 ResetHeap1024/Go 39.520 ns/op +0.02 ns/op / +0.1% (worse)
Windows MinGW 386 ResetHeap1024/LLGo 198 ns/op +4.2 ns/op / +2.2% (worse)
Windows MinGW ARM64 AfterFuncZeroDelivery/Go 659.600 ns/op -7.7 ns/op / -1.2% (better)
Windows MinGW ARM64 AfterFuncZeroDelivery/LLGo 135464 ns/op -2113 ns/op / -1.5% (better)
Windows MinGW ARM64 CreateStop/Go 204.500 ns/op +8.4 ns/op / +4.3% (worse)
Windows MinGW ARM64 CreateStop/LLGo 397.400 ns/op -8.5 ns/op / -2.1% (better)
Windows MinGW ARM64 RearmStopped/Go 70.580 ns/op -0.37 ns/op / -0.5% (better)
Windows MinGW ARM64 RearmStopped/LLGo 289.300 ns/op -3.1 ns/op / -1.1% (better)
Windows MinGW ARM64 ResetActive/Go 31.120 ns/op -0.15 ns/op / -0.5% (better)
Windows MinGW ARM64 ResetActive/LLGo 133.100 ns/op +5.7 ns/op / +4.5% (worse)
Windows MinGW ARM64 ResetHeap1024/Go 31.200 ns/op -0.46 ns/op / -1.5% (better)
Windows MinGW ARM64 ResetHeap1024/LLGo 139.200 ns/op +0.2 ns/op / +0.1% (worse)
Windows MSVC AfterFuncZeroDelivery/Go 568.800 ns/op -7.3 ns/op / -1.3% (better)
Windows MSVC AfterFuncZeroDelivery/LLGo 162652 ns/op -1290 ns/op / -0.8% (better)
Windows MSVC CreateStop/Go 115 ns/op -1.1 ns/op / -0.9% (better)
Windows MSVC CreateStop/LLGo 464.300 ns/op -25.8 ns/op / -5.3% (better)
Windows MSVC RearmStopped/Go 31.530 ns/op -0.14 ns/op / -0.4% (better)
Windows MSVC RearmStopped/LLGo 318.600 ns/op -1.3 ns/op / -0.4% (better)
Windows MSVC ResetActive/Go 20.090 ns/op +0.05 ns/op / +0.2% (worse)
Windows MSVC ResetActive/LLGo 157.200 ns/op -7.5 ns/op / -4.6% (better)
Windows MSVC ResetHeap1024/Go 20.360 ns/op -0.12 ns/op / -0.6% (better)
Windows MSVC ResetHeap1024/LLGo 139.700 ns/op 0 ns/op / +0.0%
Windows MSVC 386 AfterFuncZeroDelivery/Go 961.300 ns/op +7.2 ns/op / +0.8% (worse)
Windows MSVC 386 AfterFuncZeroDelivery/LLGo 194121 ns/op +2229 ns/op / +1.2% (worse)
Windows MSVC 386 CreateStop/Go 193 ns/op -1.1 ns/op / -0.6% (better)
Windows MSVC 386 CreateStop/LLGo 1737 ns/op +122 ns/op / +7.6% (worse)
Windows MSVC 386 RearmStopped/Go 63.190 ns/op -0.11 ns/op / -0.2% (better)
Windows MSVC 386 RearmStopped/LLGo 337.700 ns/op -1.9 ns/op / -0.6% (better)
Windows MSVC 386 ResetActive/Go 39.090 ns/op -0.03 ns/op / -0.1% (better)
Windows MSVC 386 ResetActive/LLGo 880.900 ns/op +19.1 ns/op / +2.2% (worse)
Windows MSVC 386 ResetHeap1024/Go 39.290 ns/op -0.06 ns/op / -0.2% (better)
Windows MSVC 386 ResetHeap1024/LLGo 179.900 ns/op +2.8 ns/op / +1.6% (worse)
Windows MSVC ARM64 AfterFuncZeroDelivery/Go 658.600 ns/op -9.8 ns/op / -1.5% (better)
Windows MSVC ARM64 AfterFuncZeroDelivery/LLGo 148979 ns/op +3154 ns/op / +2.2% (worse)
Windows MSVC ARM64 CreateStop/Go 202.800 ns/op -4.2 ns/op / -2.0% (better)
Windows MSVC ARM64 CreateStop/LLGo 408.700 ns/op -6.2 ns/op / -1.5% (better)
Windows MSVC ARM64 RearmStopped/Go 70.560 ns/op +0.02 ns/op / +0.02835% (worse)
Windows MSVC ARM64 RearmStopped/LLGo 297 ns/op +1.1 ns/op / +0.4% (worse)
Windows MSVC ARM64 ResetActive/Go 31.100 ns/op -0.03 ns/op / -0.1% (better)
Windows MSVC ARM64 ResetActive/LLGo 135.100 ns/op 0 ns/op / +0.0%
Windows MSVC ARM64 ResetHeap1024/Go 31.160 ns/op +0.04 ns/op / +0.1% (worse)
Windows MSVC ARM64 ResetHeap1024/LLGo 145 ns/op -0.1 ns/op / -0.1% (better)

Compared with 1e41ad3ff78c measured in the same runner job.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

LLGo WebAssembly build benchmarks

2f1b6ab7fce9 | workflow run | long-term charts

WebAssembly output sizes

Profile and compiler Wasm module vs base Generated JS glue vs base
ec32/LLGo 112483 B 0 B / +0.0% 70724 B 0 B / +0.0%
ec64/LLGo 118028 B 0 B / +0.0% 74021 B 0 B / +0.0%
js/Go 1895533 B 0 B / +0.0% 0 B 0 B / 0.0%
js/LLGo 66072 B 0 B / +0.0% 68499 B 0 B / +0.0%
wasip1/Go 1909947 B 0 B / +0.0% 0 B 0 B / 0.0%
wasip1/LLGo 72535 B 0 B / +0.0% 0 B 0 B / 0.0%
wc32/LLGo 116428 B 0 B / +0.0% 0 B 0 B / 0.0%

LLGo WebAssembly build measurements

Profile Build vs base
ec32 5.510 s -71.61 ms / -1.3% (better)
ec64 4.990 s -138.1 ms / -2.7% (better)
js 4.564 s -114.9 ms / -2.5% (better)
wasip1 3.004 s -173.6 ms / -5.5% (better)
wc32 3.771 s -64.37 ms / -1.7% (better)

Compared with 1e41ad3ff78c measured in the same runner job.

@cpunion
cpunion merged commit 76ac1f3 into xgo-dev:main Sep 11, 2026
65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants