Skip to content

refactor: reuse LLVM function callees through the LLVM 22 API - #2517

Open
zhouguangyuan0718 wants to merge 1 commit into
xgo-dev:mainfrom
zhouguangyuan0718:codex/llvm22-c-api-cleanup
Open

zhouguangyuan0718 wants to merge 1 commit into
xgo-dev:mainfrom
zhouguangyuan0718:codex/llvm22-c-api-cleanup

Conversation

@zhouguangyuan0718

Copy link
Copy Markdown
Collaborator

Use Module.GetOrInsertFunction for the large-aggregate allocator and DCE override function references, replacing three separate function lookup/create sequences. Existing declarations are reused through LLVM 22's C API, including LLVM's handling of pre-existing callees. Sites that intentionally create new functions remain on AddFunction.

Depends on xgo-dev/llvm#55. Temporarily pin the binding to github.com/zhouguangyuan0718/go-llvm v0.0.0-20260906105604-980fcc6eec0e; replace this personal-fork pin with the upstream release after the binding lands. The companion binding PR also adds non-consuming ParseIRBuffer with older-LLVM compatibility; LLGo has no production ParseIR callers to migrate.

Validation: go test ./internal/abi ./internal/dcepass passed on macOS arm64 with LLVM 22.1.8 using the pinned remote module. The binding's full LLVM 22 suite and focused LLVM 21/19 compatibility tests passed locally; remote CI 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: LLVM C API cleanup

The source refactor is clean and correct: replacing the recurring NamedFunction + IsNil + AddFunction idiom with a single GetOrInsertFunction call removes ~14 lines of boilerplate across three sites with no behavioral change. All three converted call sites use the result only as a callee (passing an explicit fnType to CreateCall) or as an opaque function-pointer operand, and none read Function-specific attributes — so the new API's "check IsAFunction before accessing function attributes" caveat does not apply here. Good, faithful consolidation.

The one substantive concern is the dependency change, not the Go logic (see inline comments).

Informational (no action): GetOrInsertFunction can, per its own contract, return a non-Function value (alias or a constant-expression cast under typed pointers) if a symbol of the same name already exists with a different type. This codebase uses opaque pointers and no converted site reads function attributes, so it is safe today; it would only matter if these helpers were reused under a typed-pointer configuration.

Additional findings

  • /workspace/llgo/THIRD_PARTY_NOTICES.md:69: [P3] THIRD_PARTY_NOTICES.md does not reflect the fork redirect: THIRD_PARTY_NOTICES.md still lists only github.com/xgo-dev/llvm and no longer names the repository actually vendored via the new replace. Low severity and arguable (the declared module path is unchanged and the redirect may be temporary), but worth a note if the fork is intended to persist. This also naturally goes away if the change is upstreamed and the replace dropped.

Comment thread go.mod

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

replace github.com/xgo-dev/llvm => github.com/zhouguangyuan0718/go-llvm v0.0.0-20260906105604-980fcc6eec0e

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.

[P1] replace directive points a core dependency at a personal fork

This redirects the LLVM binding — a core build-time dependency that generates and links native code — to a personal fork (zhouguangyuan0718/go-llvm) pinned to an untagged pseudo-version.

Concerns:

  • Build fragility / trust boundary: the build now depends on an individual account's repo, which can be renamed, made private, force-pushed, or deleted, breaking every future build and moving a core dependency outside the project's trust boundary.
  • Cannot compile against the declared upstream: GetOrInsertFunction exists only in this fork; it is absent from github.com/xgo-dev/llvm v0.9.9 still listed in require. So require and replace disagree about what actually builds.

A replace to a personal fork is fine for local/draft development but should not land on a shared branch. Recommendation: upstream GetOrInsertFunction into xgo-dev/llvm, cut a tagged release, bump the require, and drop the replace before merging.

Comment thread go.sum
github.com/xgo-dev/plan9asm v0.5.2 h1:P5eGHZiuKNcL2tlkkICa2XcxghUSnp6QzfN52x0HW1g=
github.com/xgo-dev/plan9asm v0.5.2/go.mod h1:ZzybDk59y/AXoQeYUEqxVkKWqalmCfmcfCtM9y85kQU=
github.com/zhouguangyuan0718/go-llvm v0.0.0-20260906105604-980fcc6eec0e h1:k6oC0irlMkDRyun6dX8gebXo7OmjzpHHBrHuvVLTxJU=
github.com/zhouguangyuan0718/go-llvm v0.0.0-20260906105604-980fcc6eec0e/go.mod h1:42vav2/cI5BAIcL543DZSMO9do8/aCK2z7JERH+AE+M=

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.

[P2] fork go.mod hash matches original, masking the substitution

The fork's go.mod hash (h1:42vav2/...) is byte-for-byte identical to github.com/xgo-dev/llvm v0.9.9. Because both go.mod files hash the same, nothing in the module graph visibly signals that the underlying source was swapped — only the differing zip (h1:) content hash reveals it, which is easy to overlook in a go.sum review. Reviewers should diff the fork's source against the upstream release rather than rely on go.sum here. This resolves once the dependency is upstreamed and the replace removed.

@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

3a80c32a1521 | 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% 449.495 ms -10.46 ms / -2.3% (better) 1.285 ms +64.59 us / +5.3% (worse)
Linux cprintf-lto 19600 B 0 B / +0.0% 368 B 0 B / +0.0% 457.942 ms -7.424 ms / -1.6% (better) 1.304 ms +74.09 us / +6.0% (worse)
Linux fmtprintf 1617008 B 0 B / +0.0% 493198 B 0 B / +0.0% 3.618 s +60.61 ms / +1.7% (worse) 3.109 ms +138.6 us / +4.7% (worse)
Linux fmtprintf-lto 1478744 B 0 B / +0.0% 442979 B 0 B / +0.0% 10.480 s +68.48 ms / +0.7% (worse) 2.978 ms +107.2 us / +3.7% (worse)
Linux println 62600 B 0 B / +0.0% 14972 B 0 B / +0.0% 449.170 ms -13.88 ms / -3.0% (better) 1.636 ms +99.07 us / +6.4% (worse)
Linux println-lto 54656 B 0 B / +0.0% 12537 B 0 B / +0.0% 656.894 ms +6.165 ms / +0.9% (worse) 1.627 ms +85.03 us / +5.5% (worse)
macOS cprintf 84480 B 0 B / +0.0% 17117 B 0 B / +0.0% 756.668 ms +116.9 ms / +18.3% (worse) 5.124 ms +2.895 ms / +129.8% (worse)
macOS cprintf-lto 84288 B 0 B / +0.0% 12881 B 0 B / +0.0% 919.434 ms +211.1 ms / +29.8% (worse) 3.674 ms +1.255 ms / +51.9% (worse)
macOS fmtprintf 1473408 B 0 B / +0.0% 867160 B 0 B / +0.0% 3.581 s +346.9 ms / +10.7% (worse) 8.025 ms +1.99 ms / +33.0% (worse)
macOS fmtprintf-lto 1159568 B 0 B / +0.0% 848480 B 0 B / +0.0% 9.919 s +1.246 s / +14.4% (worse) 7.972 ms +2.176 ms / +37.5% (worse)
macOS println 114800 B 0 B / +0.0% 34929 B 0 B / +0.0% 1.056 s +489.3 ms / +86.3% (worse) 10.056 ms +6.196 ms / +160.5% (worse)
macOS println-lto 118736 B 0 B / +0.0% 32881 B 0 B / +0.0% 1.362 s +273.7 ms / +25.1% (worse) 4.669 ms -5.628 ms / -54.7% (better)
Windows MinGW cprintf 19456 B 0 B / +0.0% 4550 B 0 B / +0.0% 1.079 s -7.948 ms / -0.7% (better) 3.573 ms +28.3 us / +0.8% (worse)
Windows MinGW cprintf-lto 17920 B 0 B / +0.0% 4486 B 0 B / +0.0% 1.152 s +49.21 ms / +4.5% (worse) 3.325 ms -766.2 us / -18.7% (better)
Windows MinGW fmtprintf 1886208 B 0 B / +0.0% 593766 B 0 B / +0.0% 3.968 s +11.41 ms / +0.3% (worse) 7.915 ms -615.2 us / -7.2% (better)
Windows MinGW fmtprintf-lto 1939456 B 0 B / +0.0% 557286 B 0 B / +0.0% 9.738 s -139.1 ms / -1.4% (better) 7.979 ms -1.452 ms / -15.4% (better)
Windows MinGW println 71680 B 0 B / +0.0% 24038 B 0 B / +0.0% 1.121 s +18.73 ms / +1.7% (worse) 6.264 ms -670.2 us / -9.7% (better)
Windows MinGW println-lto 66048 B 0 B / +0.0% 21014 B 0 B / +0.0% 1.312 s -25.68 ms / -1.9% (better) 6.211 ms -350.6 us / -5.3% (better)
Windows MinGW 386 cprintf 37888 B 0 B / +0.0% 5326 B 0 B / +0.0% 1.140 s -68.99 ms / -5.7% (better) 5.225 ms +119.6 us / +2.3% (worse)
Windows MinGW 386 cprintf-lto 20992 B 0 B / +0.0% 5094 B 0 B / +0.0% 1.135 s -20.86 ms / -1.8% (better) 5.451 ms +497.8 us / +10.0% (worse)
Windows MinGW 386 fmtprintf 1843200 B 0 B / +0.0% 468394 B 0 B / +0.0% 4.380 s +307 ms / +7.5% (worse) 12.543 ms +1.849 ms / +17.3% (worse)
Windows MinGW 386 fmtprintf-lto 2166272 B 0 B / +0.0% 463406 B 0 B / +0.0% 10.214 s -1.068 s / -9.5% (better) 12.258 ms -1.686 ms / -12.1% (better)
Windows MinGW 386 println 86528 B 0 B / +0.0% 20454 B 0 B / +0.0% 1.123 s +10.21 ms / +0.9% (worse) 9.015 ms +587.3 us / +7.0% (worse)
Windows MinGW 386 println-lto 71168 B 0 B / +0.0% 18398 B 0 B / +0.0% 1.347 s +36.04 ms / +2.7% (worse) 8.722 ms +182.2 us / +2.1% (worse)
Windows MinGW ARM64 cprintf 18944 B 0 B / +0.0% 4436 B 0 B / +0.0% 1.462 s -4.054 ms / -0.3% (better) 6.595 ms -76.4 us / -1.1% (better)
Windows MinGW ARM64 cprintf-lto 17920 B 0 B / +0.0% 4368 B 0 B / +0.0% 1.470 s -22.44 ms / -1.5% (better) 6.424 ms -126.1 us / -1.9% (better)
Windows MinGW ARM64 fmtprintf 1774080 B 0 B / +0.0% 506492 B 0 B / +0.0% 4.257 s +60.26 ms / +1.4% (worse) 12.275 ms -614.4 us / -4.8% (better)
Windows MinGW ARM64 fmtprintf-lto 1866752 B 0 B / +0.0% 487084 B 0 B / +0.0% 9.823 s -314.9 ms / -3.1% (better) 12.927 ms -1.25 ms / -8.8% (better)
Windows MinGW ARM64 println 69120 B 0 B / +0.0% 22688 B 0 B / +0.0% 1.432 s -31.24 ms / -2.1% (better) 10.811 ms -438.4 us / -3.9% (better)
Windows MinGW ARM64 println-lto 65024 B 0 B / +0.0% 20260 B 0 B / +0.0% 1.644 s -10.93 ms / -0.7% (better) 10.791 ms -769.8 us / -6.7% (better)
Windows MSVC cprintf 120320 B 0 B / +0.0% 65782 B 0 B / +0.0% 913.245 ms -47.77 ms / -5.0% (better) 3.345 ms -123.3 us / -3.6% (better)
Windows MSVC cprintf-lto 119808 B 0 B / +0.0% 65718 B 0 B / +0.0% 1.104 s +116.1 ms / +11.8% (worse) 4.431 ms +975 us / +28.2% (worse)
Windows MSVC fmtprintf 1616896 B 0 B / +0.0% 689286 B 0 B / +0.0% 3.682 s -110.8 ms / -2.9% (better) 9.787 ms -172.9 us / -1.7% (better)
Windows MSVC fmtprintf-lto 1627136 B 0 B / +0.0% 659686 B 0 B / +0.0% 9.128 s -32.57 ms / -0.4% (better) 10.678 ms +1.023 ms / +10.6% (worse)
Windows MSVC println 193024 B 0 B / +0.0% 119446 B 0 B / +0.0% 940.286 ms -8.367 ms / -0.9% (better) 6.994 ms -244.1 us / -3.4% (better)
Windows MSVC println-lto 190464 B 0 B / +0.0% 116822 B 0 B / +0.0% 1.089 s -53.85 ms / -4.7% (better) 7.321 ms -283.2 us / -3.7% (better)
Windows MSVC 386 cprintf 9728 B 0 B / +0.0% 3931 B 0 B / +0.0% 943.806 ms -17.2 ms / -1.8% (better) 5.676 ms -196.4 us / -3.3% (better)
Windows MSVC 386 cprintf-lto 9216 B 0 B / +0.0% 3853 B 0 B / +0.0% 972.572 ms -14.29 ms / -1.4% (better) 5.081 ms -3.502 ms / -40.8% (better)
Windows MSVC 386 fmtprintf 1186304 B 0 B / +0.0% 451761 B 0 B / +0.0% 3.768 s -41.5 ms / -1.1% (better) 12.915 ms +952.7 us / +8.0% (worse)
Windows MSVC 386 fmtprintf-lto 1241600 B 0 B / +0.0% 443525 B 0 B / +0.0% 8.763 s +85.69 ms / +1.0% (worse) 12.082 ms -496.3 us / -3.9% (better)
Windows MSVC 386 println 34816 B 0 B / +0.0% 19313 B 0 B / +0.0% 966.834 ms -62.88 ms / -6.1% (better) 9.814 ms +125 us / +1.3% (worse)
Windows MSVC 386 println-lto 33792 B 0 B / +0.0% 17463 B 0 B / +0.0% 1.147 s +20.25 ms / +1.8% (worse) 9.541 ms +164.1 us / +1.7% (worse)
Windows MSVC ARM64 cprintf 11264 B 0 B / +0.0% 3976 B 0 B / +0.0% 2.070 s +2.794 ms / +0.1% (worse) 6.930 ms +194.2 us / +2.9% (worse)
Windows MSVC ARM64 cprintf-lto 10752 B 0 B / +0.0% 3868 B 0 B / +0.0% 2.079 s -28.81 ms / -1.4% (better) 7.119 ms +104.6 us / +1.5% (worse)
Windows MSVC ARM64 fmtprintf 1362944 B 0 B / +0.0% 506316 B 0 B / +0.0% 6.475 s -50.91 ms / -0.8% (better) 14.921 ms +251.1 us / +1.7% (worse)
Windows MSVC ARM64 fmtprintf-lto 1398784 B 0 B / +0.0% 487836 B 0 B / +0.0% 15.680 s +52.52 ms / +0.3% (worse) 14.980 ms +856.2 us / +6.1% (worse)
Windows MSVC ARM64 println 42496 B 0 B / +0.0% 22264 B 0 B / +0.0% 2.062 s +19.21 ms / +0.9% (worse) 12.396 ms -41.8 us / -0.3% (better)
Windows MSVC ARM64 println-lto 40448 B 0 B / +0.0% 20156 B 0 B / +0.0% 2.369 s -13.39 ms / -0.6% (better) 12.429 ms -124 us / -1.0% (better)
Core language and compiler benchmarks
Platform Benchmark ns/op vs base
Linux BenchmarkLookupPCRandom 14.590 ns/op -0.14 ns/op / -1.0% (better)
Linux BenchmarkMergeCompilerFlags 202.100 ns/op +5.7 ns/op / +2.9% (worse)
Linux BenchmarkMergeLinkerFlags 131 ns/op +2.7 ns/op / +2.1% (worse)
Linux BenchmarkChannelBuffered 69.900 ns/op -0.28 ns/op / -0.4% (better)
Linux BenchmarkChannelHandoff 18993 ns/op +638 ns/op / +3.5% (worse)
Linux BenchmarkDefer 46.630 ns/op +0.16 ns/op / +0.3% (worse)
Linux BenchmarkDirectCall 1.164 ns/op +0.001 ns/op / +0.1% (worse)
Linux BenchmarkGlobalRead 1.164 ns/op -0.001 ns/op / -0.1% (better)
Linux BenchmarkGlobalWrite 7.759 ns/op -0.003 ns/op / -0.03865% (better)
Linux BenchmarkGoroutine 22483 ns/op -5739 ns/op / -20.3% (better)
Linux BenchmarkInterfaceCall 6.595 ns/op -0.004 ns/op / -0.1% (better)
Linux BenchmarkRuntimeGetG 2.441 ns/op +0.001 ns/op / +0.04098% (worse)
macOS BenchmarkLookupPCRandom 17.050 ns/op -4.73 ns/op / -21.7% (better)
macOS BenchmarkMergeCompilerFlags 158 ns/op -0.6 ns/op / -0.4% (better)
macOS BenchmarkMergeLinkerFlags 94.960 ns/op -20.24 ns/op / -17.6% (better)
macOS BenchmarkChannelBuffered 24.340 ns/op -11.24 ns/op / -31.6% (better)
macOS BenchmarkChannelHandoff 8089 ns/op -2838 ns/op / -26.0% (better)
macOS BenchmarkDefer 36.230 ns/op -2.11 ns/op / -5.5% (better)
macOS BenchmarkDirectCall 1.234 ns/op -0.046 ns/op / -3.6% (better)
macOS BenchmarkGlobalRead 1.287 ns/op +0.012 ns/op / +0.9% (worse)
macOS BenchmarkGlobalWrite 1.620 ns/op +0.124 ns/op / +8.3% (worse)
macOS BenchmarkGoroutine 48742 ns/op +7708 ns/op / +18.8% (worse)
macOS BenchmarkInterfaceCall 5.027 ns/op -0.336 ns/op / -6.3% (better)
macOS BenchmarkRuntimeGetG 2.123 ns/op -0.785 ns/op / -27.0% (better)
Windows MinGW BenchmarkLookupPCRandom 13.060 ns/op -0.23 ns/op / -1.7% (better)
Windows MinGW BenchmarkMergeCompilerFlags 614.900 ns/op +4.2 ns/op / +0.7% (worse)
Windows MinGW BenchmarkMergeLinkerFlags 521.900 ns/op -13.6 ns/op / -2.5% (better)
Windows MinGW BenchmarkChannelBuffered 36.900 ns/op -0.02 ns/op / -0.1% (better)
Windows MinGW BenchmarkChannelHandoff 920.500 ns/op -22.5 ns/op / -2.4% (better)
Windows MinGW BenchmarkDefer 55.710 ns/op -0.52 ns/op / -0.9% (better)
Windows MinGW BenchmarkDirectCall 1.861 ns/op +0.002 ns/op / +0.1% (worse)
Windows MinGW BenchmarkGlobalRead 1.858 ns/op +0.001 ns/op / +0.1% (worse)
Windows MinGW BenchmarkGlobalWrite 2.450 ns/op -0.001 ns/op / -0.0408% (better)
Windows MinGW BenchmarkGoroutine 84856 ns/op +1168 ns/op / +1.4% (worse)
Windows MinGW BenchmarkInterfaceCall 9.294 ns/op -0.024 ns/op / -0.3% (better)
Windows MinGW BenchmarkRuntimeGetG 1.859 ns/op -0.007 ns/op / -0.4% (better)
Windows MinGW 386 BenchmarkLookupPCRandom 26.610 ns/op +0.08 ns/op / +0.3% (worse)
Windows MinGW 386 BenchmarkMergeCompilerFlags 755.800 ns/op +10.1 ns/op / +1.4% (worse)
Windows MinGW 386 BenchmarkMergeLinkerFlags 711 ns/op +23.1 ns/op / +3.4% (worse)
Windows MinGW 386 BenchmarkChannelBuffered 43.070 ns/op +0.12 ns/op / +0.3% (worse)
Windows MinGW 386 BenchmarkChannelHandoff 1048 ns/op 0 ns/op / +0.0%
Windows MinGW 386 BenchmarkDefer 42.530 ns/op -0.41 ns/op / -1.0% (better)
Windows MinGW 386 BenchmarkDirectCall 1.547 ns/op -0.003 ns/op / -0.2% (better)
Windows MinGW 386 BenchmarkGlobalRead 1.547 ns/op -0.002 ns/op / -0.1% (better)
Windows MinGW 386 BenchmarkGlobalWrite 7.777 ns/op -0.008 ns/op / -0.1% (better)
Windows MinGW 386 BenchmarkGoroutine 88822 ns/op +1281 ns/op / +1.5% (worse)
Windows MinGW 386 BenchmarkInterfaceCall 9.597 ns/op 0 ns/op / +0.0%
Windows MinGW 386 BenchmarkRuntimeGetG 1.861 ns/op 0 ns/op / +0.0%
Windows MinGW ARM64 BenchmarkLookupPCRandom 12.070 ns/op +0.01 ns/op / +0.1% (worse)
Windows MinGW ARM64 BenchmarkMergeCompilerFlags 569.200 ns/op +3 ns/op / +0.5% (worse)
Windows MinGW ARM64 BenchmarkMergeLinkerFlags 537.600 ns/op -0.1 ns/op / -0.0186% (better)
Windows MinGW ARM64 BenchmarkChannelBuffered 43.960 ns/op +0.09 ns/op / +0.2% (worse)
Windows MinGW ARM64 BenchmarkChannelHandoff 2293 ns/op +80 ns/op / +3.6% (worse)
Windows MinGW ARM64 BenchmarkDefer 57.610 ns/op +2.37 ns/op / +4.3% (worse)
Windows MinGW ARM64 BenchmarkDirectCall 0.590 ns/op 0 ns/op / +0.0%
Windows MinGW ARM64 BenchmarkGlobalRead 0.665 ns/op -0.0005 ns/op / -0.1% (better)
Windows MinGW ARM64 BenchmarkGlobalWrite 0.590 ns/op -0.0001 ns/op / -0.01695% (better)
Windows MinGW ARM64 BenchmarkGoroutine 59457 ns/op -1757 ns/op / -2.9% (better)
Windows MinGW ARM64 BenchmarkInterfaceCall 4.721 ns/op +0.003 ns/op / +0.1% (worse)
Windows MinGW ARM64 BenchmarkRuntimeGetG 1.805 ns/op +0.036 ns/op / +2.0% (worse)
Windows MSVC BenchmarkLookupPCRandom 13.110 ns/op -0.01 ns/op / -0.1% (better)
Windows MSVC BenchmarkMergeCompilerFlags 658.400 ns/op +62.1 ns/op / +10.4% (worse)
Windows MSVC BenchmarkMergeLinkerFlags 580.200 ns/op +35.1 ns/op / +6.4% (worse)
Windows MSVC BenchmarkChannelBuffered 41.040 ns/op +3.5 ns/op / +9.3% (worse)
Windows MSVC BenchmarkChannelHandoff 1150 ns/op -88 ns/op / -7.1% (better)
Windows MSVC BenchmarkDefer 62.660 ns/op +6.93 ns/op / +12.4% (worse)
Windows MSVC BenchmarkDirectCall 1.667 ns/op +0.117 ns/op / +7.5% (worse)
Windows MSVC BenchmarkGlobalRead 1.654 ns/op +0.105 ns/op / +6.8% (worse)
Windows MSVC BenchmarkGlobalWrite 2.564 ns/op +0.093 ns/op / +3.8% (worse)
Windows MSVC BenchmarkGoroutine 84513 ns/op +3033 ns/op / +3.7% (worse)
Windows MSVC BenchmarkInterfaceCall 11.170 ns/op +1.846 ns/op / +19.8% (worse)
Windows MSVC BenchmarkRuntimeGetG 2.083 ns/op +0.215 ns/op / +11.5% (worse)
Windows MSVC 386 BenchmarkLookupPCRandom 26.620 ns/op +0.04 ns/op / +0.2% (worse)
Windows MSVC 386 BenchmarkMergeCompilerFlags 740.700 ns/op +19 ns/op / +2.6% (worse)
Windows MSVC 386 BenchmarkMergeLinkerFlags 682.800 ns/op +22.8 ns/op / +3.5% (worse)
Windows MSVC 386 BenchmarkChannelBuffered 42.880 ns/op +0.32 ns/op / +0.8% (worse)
Windows MSVC 386 BenchmarkChannelHandoff 999.600 ns/op +50.8 ns/op / +5.4% (worse)
Windows MSVC 386 BenchmarkDefer 46.020 ns/op -2.81 ns/op / -5.8% (better)
Windows MSVC 386 BenchmarkDirectCall 1.548 ns/op 0 ns/op / +0.0%
Windows MSVC 386 BenchmarkGlobalRead 1.865 ns/op +0.002 ns/op / +0.1% (worse)
Windows MSVC 386 BenchmarkGlobalWrite 7.782 ns/op +0.005 ns/op / +0.1% (worse)
Windows MSVC 386 BenchmarkGoroutine 92391 ns/op +4345 ns/op / +4.9% (worse)
Windows MSVC 386 BenchmarkInterfaceCall 9.612 ns/op -0.001 ns/op / -0.0104% (better)
Windows MSVC 386 BenchmarkRuntimeGetG 2.167 ns/op 0 ns/op / +0.0%
Windows MSVC ARM64 BenchmarkLookupPCRandom 12.070 ns/op 0 ns/op / +0.0%
Windows MSVC ARM64 BenchmarkMergeCompilerFlags 579.100 ns/op +16.3 ns/op / +2.9% (worse)
Windows MSVC ARM64 BenchmarkMergeLinkerFlags 537.900 ns/op +3.1 ns/op / +0.6% (worse)
Windows MSVC ARM64 BenchmarkChannelBuffered 44.030 ns/op -3.07 ns/op / -6.5% (better)
Windows MSVC ARM64 BenchmarkChannelHandoff 2434 ns/op -42 ns/op / -1.7% (better)
Windows MSVC ARM64 BenchmarkDefer 63.780 ns/op +1.54 ns/op / +2.5% (worse)
Windows MSVC ARM64 BenchmarkDirectCall 0.590 ns/op +0.0001 ns/op / +0.01697% (worse)
Windows MSVC ARM64 BenchmarkGlobalRead 0.663 ns/op -0.0005 ns/op / -0.1% (better)
Windows MSVC ARM64 BenchmarkGlobalWrite 3.797 ns/op +0.003 ns/op / +0.1% (worse)
Windows MSVC ARM64 BenchmarkGoroutine 59394 ns/op +5043 ns/op / +9.3% (worse)
Windows MSVC ARM64 BenchmarkInterfaceCall 4.731 ns/op +0.001 ns/op / +0.02114% (worse)
Windows MSVC ARM64 BenchmarkRuntimeGetG 1.770 ns/op -0.028 ns/op / -1.6% (better)

Timer runtime benchmarks

Platform Operation and runtime ns/op vs base
Linux AfterFuncZeroDelivery/Go 897.700 ns/op -8.6 ns/op / -0.9% (better)
Linux AfterFuncZeroDelivery/LLGo 33480 ns/op +249 ns/op / +0.7% (worse)
Linux CreateStop/Go 290.800 ns/op +1.8 ns/op / +0.6% (worse)
Linux CreateStop/LLGo 1871 ns/op +523 ns/op / +38.8% (worse)
Linux RearmStopped/Go 115.900 ns/op 0 ns/op / +0.0%
Linux RearmStopped/LLGo 1298 ns/op -24 ns/op / -1.8% (better)
Linux ResetActive/Go 68.710 ns/op +0.05 ns/op / +0.1% (worse)
Linux ResetActive/LLGo 595.600 ns/op -113.8 ns/op / -16.0% (better)
Linux ResetHeap1024/Go 67.090 ns/op +0.07 ns/op / +0.1% (worse)
Linux ResetHeap1024/LLGo 187.400 ns/op -2.8 ns/op / -1.5% (better)
macOS AfterFuncZeroDelivery/Go 600.400 ns/op +121.8 ns/op / +25.4% (worse)
macOS AfterFuncZeroDelivery/LLGo 119639 ns/op +48263 ns/op / +67.6% (worse)
macOS CreateStop/Go 243 ns/op +65.6 ns/op / +37.0% (worse)
macOS CreateStop/LLGo 710.700 ns/op +274.7 ns/op / +63.0% (worse)
macOS RearmStopped/Go 78.570 ns/op +11.63 ns/op / +17.4% (worse)
macOS RearmStopped/LLGo 634.100 ns/op +248.5 ns/op / +64.4% (worse)
macOS ResetActive/Go 55.480 ns/op +6.45 ns/op / +13.2% (worse)
macOS ResetActive/LLGo 180.800 ns/op +32.5 ns/op / +21.9% (worse)
macOS ResetHeap1024/Go 56.820 ns/op -0.63 ns/op / -1.1% (better)
macOS ResetHeap1024/LLGo 95.080 ns/op -0.2 ns/op / -0.2% (better)
Windows MinGW AfterFuncZeroDelivery/Go 565.100 ns/op +11.9 ns/op / +2.2% (worse)
Windows MinGW AfterFuncZeroDelivery/LLGo 164287 ns/op +882 ns/op / +0.5% (worse)
Windows MinGW CreateStop/Go 114.500 ns/op -1.4 ns/op / -1.2% (better)
Windows MinGW CreateStop/LLGo 469.700 ns/op -139.6 ns/op / -22.9% (better)
Windows MinGW RearmStopped/Go 31.290 ns/op -0.36 ns/op / -1.1% (better)
Windows MinGW RearmStopped/LLGo 297.500 ns/op +11.4 ns/op / +4.0% (worse)
Windows MinGW ResetActive/Go 20.080 ns/op 0 ns/op / +0.0%
Windows MinGW ResetActive/LLGo 159.200 ns/op -21.8 ns/op / -12.0% (better)
Windows MinGW ResetHeap1024/Go 20.360 ns/op -0.07 ns/op / -0.3% (better)
Windows MinGW ResetHeap1024/LLGo 140.800 ns/op +1.2 ns/op / +0.9% (worse)
Windows MinGW 386 AfterFuncZeroDelivery/Go 958 ns/op +5 ns/op / +0.5% (worse)
Windows MinGW 386 AfterFuncZeroDelivery/LLGo 186326 ns/op -3917 ns/op / -2.1% (better)
Windows MinGW 386 CreateStop/Go 194.500 ns/op +3 ns/op / +1.6% (worse)
Windows MinGW 386 CreateStop/LLGo 2156 ns/op -30 ns/op / -1.4% (better)
Windows MinGW 386 RearmStopped/Go 63.230 ns/op -0.02 ns/op / -0.03162% (better)
Windows MinGW 386 RearmStopped/LLGo 365.200 ns/op -1.7 ns/op / -0.5% (better)
Windows MinGW 386 ResetActive/Go 38.990 ns/op +0.03 ns/op / +0.1% (worse)
Windows MinGW 386 ResetActive/LLGo 892.600 ns/op -88.7 ns/op / -9.0% (better)
Windows MinGW 386 ResetHeap1024/Go 39.340 ns/op +0.02 ns/op / +0.1% (worse)
Windows MinGW 386 ResetHeap1024/LLGo 193.800 ns/op -0.2 ns/op / -0.1% (better)
Windows MinGW ARM64 AfterFuncZeroDelivery/Go 661.800 ns/op -5.4 ns/op / -0.8% (better)
Windows MinGW ARM64 AfterFuncZeroDelivery/LLGo 136608 ns/op +3083 ns/op / +2.3% (worse)
Windows MinGW ARM64 CreateStop/Go 200.500 ns/op +4.1 ns/op / +2.1% (worse)
Windows MinGW ARM64 CreateStop/LLGo 380.600 ns/op -14.1 ns/op / -3.6% (better)
Windows MinGW ARM64 RearmStopped/Go 70.490 ns/op 0 ns/op / +0.0%
Windows MinGW ARM64 RearmStopped/LLGo 279.900 ns/op -2.8 ns/op / -1.0% (better)
Windows MinGW ARM64 ResetActive/Go 31.010 ns/op -0.02 ns/op / -0.1% (better)
Windows MinGW ARM64 ResetActive/LLGo 125.100 ns/op -2 ns/op / -1.6% (better)
Windows MinGW ARM64 ResetHeap1024/Go 31.140 ns/op +0.03 ns/op / +0.1% (worse)
Windows MinGW ARM64 ResetHeap1024/LLGo 138.200 ns/op +0.3 ns/op / +0.2% (worse)
Windows MSVC AfterFuncZeroDelivery/Go 562.900 ns/op +8.6 ns/op / +1.6% (worse)
Windows MSVC AfterFuncZeroDelivery/LLGo 160622 ns/op -2846 ns/op / -1.7% (better)
Windows MSVC CreateStop/Go 116.900 ns/op -1.3 ns/op / -1.1% (better)
Windows MSVC CreateStop/LLGo 467.400 ns/op +15.6 ns/op / +3.5% (worse)
Windows MSVC RearmStopped/Go 31.640 ns/op -0.06 ns/op / -0.2% (better)
Windows MSVC RearmStopped/LLGo 286.200 ns/op +0.2 ns/op / +0.1% (worse)
Windows MSVC ResetActive/Go 20.400 ns/op +0.18 ns/op / +0.9% (worse)
Windows MSVC ResetActive/LLGo 143.900 ns/op -13.8 ns/op / -8.8% (better)
Windows MSVC ResetHeap1024/Go 20.460 ns/op -0.05 ns/op / -0.2% (better)
Windows MSVC ResetHeap1024/LLGo 138 ns/op +1.8 ns/op / +1.3% (worse)
Windows MSVC 386 AfterFuncZeroDelivery/Go 959.400 ns/op +1.4 ns/op / +0.1% (worse)
Windows MSVC 386 AfterFuncZeroDelivery/LLGo 194627 ns/op -2339 ns/op / -1.2% (better)
Windows MSVC 386 CreateStop/Go 193.700 ns/op +2.2 ns/op / +1.1% (worse)
Windows MSVC 386 CreateStop/LLGo 1647 ns/op +59 ns/op / +3.7% (worse)
Windows MSVC 386 RearmStopped/Go 63.220 ns/op -0.13 ns/op / -0.2% (better)
Windows MSVC 386 RearmStopped/LLGo 332.500 ns/op +1.3 ns/op / +0.4% (worse)
Windows MSVC 386 ResetActive/Go 39.090 ns/op -0.03 ns/op / -0.1% (better)
Windows MSVC 386 ResetActive/LLGo 896.400 ns/op -35.6 ns/op / -3.8% (better)
Windows MSVC 386 ResetHeap1024/Go 39.390 ns/op -0.03 ns/op / -0.1% (better)
Windows MSVC 386 ResetHeap1024/LLGo 175.700 ns/op -1.1 ns/op / -0.6% (better)
Windows MSVC ARM64 AfterFuncZeroDelivery/Go 667.500 ns/op -11.7 ns/op / -1.7% (better)
Windows MSVC ARM64 AfterFuncZeroDelivery/LLGo 125489 ns/op -2290 ns/op / -1.8% (better)
Windows MSVC ARM64 CreateStop/Go 200.300 ns/op -14.8 ns/op / -6.9% (better)
Windows MSVC ARM64 CreateStop/LLGo 415.900 ns/op -6.7 ns/op / -1.6% (better)
Windows MSVC ARM64 RearmStopped/Go 70.600 ns/op +0.24 ns/op / +0.3% (worse)
Windows MSVC ARM64 RearmStopped/LLGo 296.200 ns/op +3.3 ns/op / +1.1% (worse)
Windows MSVC ARM64 ResetActive/Go 31.050 ns/op -0.36 ns/op / -1.1% (better)
Windows MSVC ARM64 ResetActive/LLGo 134.100 ns/op +1.8 ns/op / +1.4% (worse)
Windows MSVC ARM64 ResetHeap1024/Go 31.200 ns/op -0.7 ns/op / -2.2% (better)
Windows MSVC ARM64 ResetHeap1024/LLGo 141.800 ns/op -1.2 ns/op / -0.8% (better)

Compared with 9317592bb30a measured in the same runner job.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

LLGo WebAssembly build benchmarks

3a80c32a1521 | workflow run | long-term charts

WebAssembly output sizes

Profile and compiler Wasm module vs base Generated JS glue vs base
ec32/LLGo 112737 B 0 B / +0.0% 70724 B 0 B / +0.0%
ec64/LLGo 118288 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 65512 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 71802 B 0 B / +0.0% 0 B 0 B / 0.0%
wc32/LLGo 116701 B 0 B / +0.0% 0 B 0 B / 0.0%

LLGo WebAssembly build measurements

Profile Build vs base
ec32 5.038 s -120.7 ms / -2.3% (better)
ec64 4.707 s -145.9 ms / -3.0% (better)
js 4.137 s -102.2 ms / -2.4% (better)
wasip1 2.865 s -108.5 ms / -3.6% (better)
wc32 3.553 s -85.95 ms / -2.4% (better)

Compared with 9317592bb30a measured in the same runner job.

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.

1 participant