Skip to content

fix(cl): support C-prefixed variables and migrate native bindings - #2882

Merged
xushiwei merged 5 commits into
xgo-dev:mainfrom
cpunion:fix/explicit-c-variable-bindings
Oct 20, 2026
Merged

xushiwei merged 5 commits into
xgo-dev:mainfrom
cpunion:fix/explicit-c-variable-bindings

Conversation

@cpunion

@cpunion cpunion commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Implement the native-variable migration prerequisite for #2879 (clarified storage rules); also relates to #2878.

//go:linkname Counter C.native_counter
var Counter int32 // external native storage named native_counter

Strip C. and use native storage representation for variable bindings through both go:linkname and llgo:link. Migrate 85 native bindings in the runtime, demos, and fixtures. Ordinary Go variable storage/merging follows in #2894; native function entries and placeholder rules follow in #2895. This PR preserves existing bare-target behavior during migration.

Add C-backed tests for scalar, array, pointer, and function-pointer globals: native initializers, address identity, Go/C writes, directive aliases, and nil/restored callbacks. Extend aggregate-variable IR checks to Linux and Windows. Fix dependency setup for nested checkouts and allow Windows MSVC cache cleanup to finish within the job timeout.

Validation: native cgo tests, cross-target IR fixtures, WASI smoke, installer tests, and CI workflow checks pass. Latest CI: 115 successful checks, one skipped.

Companion: goplus/lib#53 migrates 14 native variables and must follow this compiler support. llcppg already emits C. targets.

@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: Explicit C variable bindings

Clean, well-scoped change. It adds //go:linkname Name C.symbol support for variables in cl/import.go (symmetric with the existing function-side C. handling at import.go:882), migrates all bare-symbol C linknames across runtime/, _demo/, cl/_testlibc/, and test/cgo/ to the explicit C. form, and adds solid tests plus README docs.

Verified during review (no action needed):

  • The new C. branch is placed first in varName(), matching the function-side ordering; C.-prefixed targets are unambiguous since C identifiers cannot contain ..
  • Migration is complete — the only remaining bare two-token linkname (cl/_testdata/llgointrinsics/in.go:83) is an intentional self-trampoline, not a C binding.
  • README block is embedme-safe (first line has spaces, no embedme reference comment), and the documented claims — native storage/initializer, no Go-side initializer, function-pointer support, and llgo:link parity — all match the implementation and tests. Both directives share the same SetLinkname → varName() path, so C. works for llgo:link too.
  • cl/_testrt/cvar/in.go LITTEST target matrix is valid: the fixture is IR-check-only with portable external global assertions and no import "C", so cross-target coverage needs no C toolchain.
  • No performance or security concerns. The _demo compiler-rt builtins moving from goFunc to cFunc lowering is an ABI-correctness improvement, not a regression.

Non-blocking note (not introduced by this PR): A malformed directive //go:linkname Name C. (empty symbol after the prefix) is accepted silently — varName() returns v[2:] == "" (cl/import.go:940), and the function path has the same gap (import.go:883). It surfaces only as an opaque link-time failure rather than a positioned compiler diagnostic. If you want to harden it later, reject an empty target at directive-collection time, mirroring the existing //llgo:link requires ... a target error.

One minor inline readability suggestion below. No correctness defects found.

Comment thread test/cgo/linkname_vars_test.go Outdated
@codecov

codecov Bot commented Oct 20, 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

Copy link
Copy Markdown

LLGo WebAssembly build benchmarks

ff55ff2a6e72 | workflow run | long-term charts

WebAssembly output sizes
Example, profile and compiler Wasm module vs base Generated JS glue vs base
cprintf/j32-emscripten/LLGo 147058 B 0 B / +0.0% 88541 B 0 B / +0.0%
cprintf/j32-goos-js/LLGo 145666 B 0 B / +0.0% 72985 B 0 B / +0.0%
cprintf/j64-emscripten-memory64/LLGo 134527 B 0 B / +0.0% 91712 B 0 B / +0.0%
cprintf/w32-goos-wasip1/LLGo 156385 B 0 B / +0.0% 0 B 0 B / 0.0%
cprintf/w32-wasi/LLGo 157083 B 0 B / +0.0% 0 B 0 B / 0.0%
fmtprintf/j32-emscripten/LLGo 2984026 B 0 B / +0.0% 120989 B 0 B / +0.0%
fmtprintf/j32-goos-js/Go 2526852 B 0 B / +0.0% 0 B 0 B / 0.0%
fmtprintf/j32-goos-js/LLGo 3074787 B 0 B / +0.0% 92052 B 0 B / +0.0%
fmtprintf/j64-emscripten-memory64/LLGo 2748865 B 0 B / +0.0% 125530 B 0 B / +0.0%
fmtprintf/w32-goos-wasip1/Go 2500019 B 0 B / +0.0% 0 B 0 B / 0.0%
fmtprintf/w32-goos-wasip1/LLGo 2343583 B 0 B / +0.0% 0 B 0 B / 0.0%
fmtprintf/w32-wasi/LLGo 2340279 B 0 B / +0.0% 0 B 0 B / 0.0%
j32-emscripten/LLGo 146575 B 0 B / +0.0% 88541 B 0 B / +0.0%
j32-goos-js/Go 1895533 B 0 B / +0.0% 0 B 0 B / 0.0%
j32-goos-js/LLGo 145416 B 0 B / +0.0% 72985 B 0 B / +0.0%
j64-emscripten-memory64/LLGo 134082 B 0 B / +0.0% 91712 B 0 B / +0.0%
reflectcall/j32-emscripten/LLGo 1510137 B 0 B / +0.0% 95329 B 0 B / +0.0%
reflectcall/j32-goos-js/Go 2191221 B 0 B / +0.0% 0 B 0 B / 0.0%
reflectcall/j32-goos-js/LLGo 1562300 B 0 B / +0.0% 79769 B 0 B / +0.0%
reflectcall/j64-emscripten-memory64/LLGo 1391239 B 0 B / +0.0% 99026 B 0 B / +0.0%
reflectcall/w32-goos-wasip1/Go 2205707 B 0 B / +0.0% 0 B 0 B / 0.0%
reflectcall/w32-goos-wasip1/LLGo 1273770 B 0 B / +0.0% 0 B 0 B / 0.0%
reflectcall/w32-wasi/LLGo 1271411 B 0 B / +0.0% 0 B 0 B / 0.0%
w32-goos-wasip1/Go 1909947 B 0 B / +0.0% 0 B 0 B / 0.0%
w32-goos-wasip1/LLGo 156059 B 0 B / +0.0% 0 B 0 B / 0.0%
w32-wasi/LLGo 156757 B 0 B / +0.0% 0 B 0 B / 0.0%
LLGo WebAssembly build measurements
Example and profile Build vs base
j32-emscripten 7.556 s -338.9 ms / -4.3% (better)
j32-goos-js 7.358 s -539.1 ms / -6.8% (better)
j64-emscripten-memory64 6.546 s +105.5 ms / +1.6% (worse)
reflectcall/w32-wasi 23.876 s -63.66 ms / -0.3% (better)
w32-goos-wasip1 4.504 s -374 ms / -7.7% (better)
w32-wasi 4.414 s +124 ms / +2.9% (worse)

Compared with 2905593ea979 measured in the same runner job.

@github-actions

Copy link
Copy Markdown

LLGo baseline benchmarks

ff55ff2a6e72 | 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 8336 B 0 B / +0.0% 387 B 0 B / +0.0% 860.458 ms -25.81 ms / -2.9% (better) 1.272 ms +23.68 us / +1.9% (worse)
Linux cprintf-lto 8120 B 0 B / +0.0% 368 B 0 B / +0.0% 848.261 ms -24.23 ms / -2.8% (better) 1.259 ms -31.09 us / -2.4% (better)
Linux fmtprintf 2499456 B -16 B / -0.0006401% (better) 506861 B 0 B / +0.0% 5.466 s -781.2 ms / -12.5% (better) 3.795 ms -653.1 us / -14.7% (better)
Linux fmtprintf-lto 1959424 B +40 B / +0.002041% (worse) 444788 B 0 B / +0.0% 23.907 s -1.653 s / -6.5% (better) 3.572 ms -155.6 us / -4.2% (better)
Linux println 229128 B +24 B / +0.01048% (worse) 17095 B 0 B / +0.0% 893.136 ms -166.9 ms / -15.7% (better) 1.622 ms -70.99 us / -4.2% (better)
Linux println-lto 92320 B -8 B / -0.008665% (better) 14484 B 0 B / +0.0% 1.512 s -198.7 ms / -11.6% (better) 1.643 ms -52.53 us / -3.1% (better)
macOS cprintf 50672 B 0 B / +0.0% 4409 B 0 B / +0.0% 874.566 ms -741.6 ms / -45.9% (better) 2.595 ms -2.341 ms / -47.4% (better)
macOS cprintf-lto 50592 B -16 B / -0.03162% (better) 161 B 0 B / +0.0% 888.578 ms -364.5 ms / -29.1% (better) 2.889 ms -2.879 ms / -49.9% (better)
macOS fmtprintf 1659808 B 0 B / +0.0% 883620 B 0 B / +0.0% 5.371 s +330.7 ms / +6.6% (worse) 38.557 ms +5.56 ms / +16.9% (worse)
macOS fmtprintf-lto 1362160 B -16 B / -0.001175% (better) 766720 B 0 B / +0.0% 9.806 s +103.3 ms / +1.1% (worse) 55.593 ms -36.72 ms / -39.8% (better)
macOS println 96512 B 0 B / +0.0% 24519 B 0 B / +0.0% 1.119 s -128.8 ms / -10.3% (better) 5.704 ms +1.082 ms / +23.4% (worse)
macOS println-lto 84112 B -16 B / -0.01902% (better) 21732 B 0 B / +0.0% 1.192 s -175.6 ms / -12.8% (better) 4.399 ms -2.499 ms / -36.2% (better)
Windows MinGW cprintf 675840 B 0 B / +0.0% 4390 B 0 B / +0.0% 1.291 s -70.02 ms / -5.1% (better) 2.833 ms -39.7 us / -1.4% (better)
Windows MinGW cprintf-lto 44544 B 0 B / +0.0% 4342 B 0 B / +0.0% 1.336 s -46.57 ms / -3.4% (better) 2.874 ms +29 us / +1.0% (worse)
Windows MinGW fmtprintf 5471232 B 0 B / +0.0% 605958 B 0 B / +0.0% 4.344 s +74.31 ms / +1.7% (worse) 8.783 ms -758.4 us / -7.9% (better)
Windows MinGW fmtprintf-lto 4158976 B 0 B / +0.0% 553094 B 0 B / +0.0% 10.585 s +222.4 ms / +2.1% (worse) 8.202 ms -681 us / -7.7% (better)
Windows MinGW println 732672 B 0 B / +0.0% 25286 B 0 B / +0.0% 1.313 s -35.68 ms / -2.6% (better) 5.189 ms +53.7 us / +1.0% (worse)
Windows MinGW println-lto 210944 B 0 B / +0.0% 22166 B 0 B / +0.0% 1.534 s -8.625 ms / -0.6% (better) 5.180 ms -368.5 us / -6.6% (better)
Windows MinGW 386 cprintf 626688 B 0 B / +0.0% 5352 B 0 B / +0.0% 1.215 s -15.7 ms / -1.3% (better) 3.771 ms -54 us / -1.4% (better)
Windows MinGW 386 cprintf-lto 104448 B 0 B / +0.0% 5112 B 0 B / +0.0% 1.252 s -3.278 ms / -0.3% (better) 3.874 ms +40.1 us / +1.0% (worse)
Windows MinGW 386 fmtprintf 4773376 B 0 B / +0.0% 473886 B 0 B / +0.0% 4.226 s -9.942 ms / -0.2% (better) 9.639 ms -100.9 us / -1.0% (better)
Windows MinGW 386 fmtprintf-lto 4160512 B 0 B / +0.0% 452294 B 0 B / +0.0% 10.277 s -388.4 ms / -3.6% (better) 9.976 ms -116.3 us / -1.2% (better)
Windows MinGW 386 println 680960 B 0 B / +0.0% 21694 B 0 B / +0.0% 1.236 s -32.72 ms / -2.6% (better) 6.598 ms -6.8 us / -0.1% (better)
Windows MinGW 386 println-lto 260608 B 0 B / +0.0% 19514 B 0 B / +0.0% 1.443 s -51.14 ms / -3.4% (better) 6.826 ms +180.6 us / +2.7% (worse)
Windows MinGW ARM64 cprintf 686080 B 0 B / +0.0% 4204 B 0 B / +0.0% 2.055 s +178.5 ms / +9.5% (worse) 7.058 ms +1.009 ms / +16.7% (worse)
Windows MinGW ARM64 cprintf-lto 44032 B 0 B / +0.0% 4156 B 0 B / +0.0% 2.045 s +127.3 ms / +6.6% (worse) 7.139 ms +1.311 ms / +22.5% (worse)
Windows MinGW ARM64 fmtprintf 5379072 B 0 B / +0.0% 514048 B 0 B / +0.0% 5.642 s +187.4 ms / +3.4% (worse) 15.471 ms +451 us / +3.0% (worse)
Windows MinGW ARM64 fmtprintf-lto 4325376 B 0 B / +0.0% 480140 B 0 B / +0.0% 12.111 s -12.32 ms / -0.1% (better) 14.202 ms -2.506 ms / -15.0% (better)
Windows MinGW ARM64 println 738816 B 0 B / +0.0% 23928 B 0 B / +0.0% 2.035 s +140.6 ms / +7.4% (worse) 11.908 ms +440.3 us / +3.8% (worse)
Windows MinGW ARM64 println-lto 218112 B 0 B / +0.0% 21284 B 0 B / +0.0% 2.288 s +85.09 ms / +3.9% (worse) 11.490 ms -434.8 us / -3.6% (better)
Windows MSVC cprintf 920576 B 0 B / +0.0% 66003 B 0 B / +0.0% 1.531 s -87.89 ms / -5.4% (better) 3.318 ms -42.8 us / -1.3% (better)
Windows MSVC cprintf-lto 292352 B 0 B / +0.0% 65971 B 0 B / +0.0% 1.803 s +228.1 ms / +14.5% (worse) 3.475 ms +117.3 us / +3.5% (worse)
Windows MSVC fmtprintf 5771264 B 0 B / +0.0% 701862 B 0 B / +0.0% 5.208 s +47.47 ms / +0.9% (worse) 12.719 ms +1.12 ms / +9.7% (worse)
Windows MSVC fmtprintf-lto 4482048 B 0 B / +0.0% 652806 B 0 B / +0.0% 12.078 s +246.3 ms / +2.1% (worse) 12.246 ms +45.9 us / +0.4% (worse)
Windows MSVC println 1043968 B 0 B / +0.0% 121334 B 0 B / +0.0% 1.550 s +23.71 ms / +1.6% (worse) 7.249 ms +114.1 us / +1.6% (worse)
Windows MSVC println-lto 531456 B 0 B / +0.0% 118870 B 0 B / +0.0% 1.782 s -31.36 ms / -1.7% (better) 7.280 ms -154.8 us / -2.1% (better)
Windows MSVC 386 cprintf 538112 B 0 B / +0.0% 3947 B 0 B / +0.0% 1.595 s -1.885 ms / -0.1% (better) 5.636 ms -1.112 ms / -16.5% (better)
Windows MSVC 386 cprintf-lto 44544 B 0 B / +0.0% 3901 B 0 B / +0.0% 1.604 s -44.73 ms / -2.7% (better) 7.147 ms +241.2 us / +3.5% (worse)
Windows MSVC 386 fmtprintf 4505600 B 0 B / +0.0% 457314 B 0 B / +0.0% 5.589 s -2.101 ms / -0.03759% (better) 15.008 ms +337.5 us / +2.3% (worse)
Windows MSVC 386 fmtprintf-lto 3909120 B 0 B / +0.0% 427681 B 0 B / +0.0% 12.472 s +146.5 ms / +1.2% (worse) 15.325 ms +1.02 ms / +7.1% (worse)
Windows MSVC 386 println 593408 B 0 B / +0.0% 20566 B 0 B / +0.0% 1.579 s -28.36 ms / -1.8% (better) 10.695 ms -17.9 us / -0.2% (better)
Windows MSVC 386 println-lto 200192 B 0 B / +0.0% 18711 B 0 B / +0.0% 1.839 s +4.472 ms / +0.2% (worse) 11.520 ms +1.338 ms / +13.1% (worse)
Windows MSVC ARM64 cprintf 686592 B 0 B / +0.0% 4240 B 0 B / +0.0% 1.726 s +27.75 ms / +1.6% (worse) 7.721 ms +157.8 us / +2.1% (worse)
Windows MSVC ARM64 cprintf-lto 49152 B 0 B / +0.0% 4140 B 0 B / +0.0% 1.722 s +33.7 ms / +2.0% (worse) 7.413 ms -121.3 us / -1.6% (better)
Windows MSVC ARM64 fmtprintf 5376000 B 0 B / +0.0% 514148 B 0 B / +0.0% 5.289 s -92.31 ms / -1.7% (better) 16.773 ms -1.947 ms / -10.4% (better)
Windows MSVC ARM64 fmtprintf-lto 4332544 B 0 B / +0.0% 480976 B 0 B / +0.0% 11.738 s -361.5 ms / -3.0% (better) 18.690 ms +963.9 us / +5.4% (worse)
Windows MSVC ARM64 println 741376 B 0 B / +0.0% 24200 B 0 B / +0.0% 1.705 s -17.67 ms / -1.0% (better) 12.973 ms -920.5 us / -6.6% (better)
Windows MSVC ARM64 println-lto 223232 B 0 B / +0.0% 21688 B 0 B / +0.0% 1.931 s -89.46 ms / -4.4% (better) 12.954 ms -577.8 us / -4.3% (better)
Core language and compiler benchmarks
Platform Benchmark ns/op vs base
Linux BenchmarkLookupPCRandom 14.440 ns/op -0.83 ns/op / -5.4% (better)
Linux BenchmarkMergeCompilerFlags 195.200 ns/op -7.7 ns/op / -3.8% (better)
Linux BenchmarkMergeLinkerFlags 131.500 ns/op -5.9 ns/op / -4.3% (better)
Linux BenchmarkChannelBuffered 57.350 ns/op +0.31 ns/op / +0.5% (worse)
Linux BenchmarkChannelHandoff 13513 ns/op -30 ns/op / -0.2% (better)
Linux BenchmarkDefer 52.690 ns/op -1.07 ns/op / -2.0% (better)
Linux BenchmarkDirectCall 1.177 ns/op -0.064 ns/op / -5.2% (better)
Linux BenchmarkGlobalRead 1.557 ns/op -0.006 ns/op / -0.4% (better)
Linux BenchmarkGlobalWrite 7.776 ns/op -0.01 ns/op / -0.1% (better)
Linux BenchmarkGoroutine 24800 ns/op +477 ns/op / +2.0% (worse)
Linux BenchmarkInterfaceCall 6.007 ns/op -0.037 ns/op / -0.6% (better)
Linux BenchmarkRuntimeGetG 2.984 ns/op +0.004 ns/op / +0.1% (worse)
macOS BenchmarkLookupPCRandom 16.050 ns/op -1.41 ns/op / -8.1% (better)
macOS BenchmarkMergeCompilerFlags 150.900 ns/op -0.3 ns/op / -0.2% (better)
macOS BenchmarkMergeLinkerFlags 89.060 ns/op -3.33 ns/op / -3.6% (better)
macOS BenchmarkChannelBuffered 29.410 ns/op -1.02 ns/op / -3.4% (better)
macOS BenchmarkChannelHandoff 10628 ns/op -2733 ns/op / -20.5% (better)
macOS BenchmarkDefer 43.480 ns/op -8.26 ns/op / -16.0% (better)
macOS BenchmarkDirectCall 1.246 ns/op +0.042 ns/op / +3.5% (worse)
macOS BenchmarkGlobalRead 1.305 ns/op +0.046 ns/op / +3.7% (worse)
macOS BenchmarkGlobalWrite 1.398 ns/op -0.082 ns/op / -5.5% (better)
macOS BenchmarkGoroutine 61957 ns/op -3035 ns/op / -4.7% (better)
macOS BenchmarkInterfaceCall 5.296 ns/op +0.493 ns/op / +10.3% (worse)
macOS BenchmarkRuntimeGetG 2.388 ns/op -0.324 ns/op / -11.9% (better)
Windows MinGW BenchmarkLookupPCRandom 9.716 ns/op +0.043 ns/op / +0.4% (worse)
Windows MinGW BenchmarkMergeCompilerFlags 393.600 ns/op +8.6 ns/op / +2.2% (worse)
Windows MinGW BenchmarkMergeLinkerFlags 344.500 ns/op +2.4 ns/op / +0.7% (worse)
Windows MinGW BenchmarkChannelBuffered 24.180 ns/op +0.24 ns/op / +1.0% (worse)
Windows MinGW BenchmarkChannelHandoff 1147 ns/op +22 ns/op / +2.0% (worse)
Windows MinGW BenchmarkDefer 43.290 ns/op -0.32 ns/op / -0.7% (better)
Windows MinGW BenchmarkDirectCall 1.356 ns/op -0.011 ns/op / -0.8% (better)
Windows MinGW BenchmarkGlobalRead 1.357 ns/op -0.01 ns/op / -0.7% (better)
Windows MinGW BenchmarkGlobalWrite 2.164 ns/op -0.021 ns/op / -1.0% (better)
Windows MinGW BenchmarkGoroutine 59252 ns/op +677 ns/op / +1.2% (worse)
Windows MinGW BenchmarkInterfaceCall 6.804 ns/op -0.22 ns/op / -3.1% (better)
Windows MinGW BenchmarkRuntimeGetG 1.900 ns/op -0.005 ns/op / -0.3% (better)
Windows MinGW 386 BenchmarkLookupPCRandom 21.550 ns/op 0 ns/op / +0.0%
Windows MinGW 386 BenchmarkMergeCompilerFlags 549.800 ns/op -4.4 ns/op / -0.8% (better)
Windows MinGW 386 BenchmarkMergeLinkerFlags 518 ns/op +2.2 ns/op / +0.4% (worse)
Windows MinGW 386 BenchmarkChannelBuffered 33.840 ns/op +0.01 ns/op / +0.02956% (worse)
Windows MinGW 386 BenchmarkChannelHandoff 790.800 ns/op +25.2 ns/op / +3.3% (worse)
Windows MinGW 386 BenchmarkDefer 35.210 ns/op +0.59 ns/op / +1.7% (worse)
Windows MinGW 386 BenchmarkDirectCall 1.357 ns/op 0 ns/op / +0.0%
Windows MinGW 386 BenchmarkGlobalRead 1.357 ns/op -0.001 ns/op / -0.1% (better)
Windows MinGW 386 BenchmarkGlobalWrite 6.978 ns/op -0.002 ns/op / -0.02865% (better)
Windows MinGW 386 BenchmarkGoroutine 77758 ns/op -109 ns/op / -0.1% (better)
Windows MinGW 386 BenchmarkInterfaceCall 7.330 ns/op -0.01 ns/op / -0.1% (better)
Windows MinGW 386 BenchmarkRuntimeGetG 1.636 ns/op +0.002 ns/op / +0.1% (worse)
Windows MinGW ARM64 BenchmarkLookupPCRandom 12.110 ns/op +0.01 ns/op / +0.1% (worse)
Windows MinGW ARM64 BenchmarkMergeCompilerFlags 563.400 ns/op -10.1 ns/op / -1.8% (better)
Windows MinGW ARM64 BenchmarkMergeLinkerFlags 524.100 ns/op -4.4 ns/op / -0.8% (better)
Windows MinGW ARM64 BenchmarkChannelBuffered 38.320 ns/op +0.74 ns/op / +2.0% (worse)
Windows MinGW ARM64 BenchmarkChannelHandoff 5512 ns/op +110 ns/op / +2.0% (worse)
Windows MinGW ARM64 BenchmarkDefer 55.060 ns/op -1.78 ns/op / -3.1% (better)
Windows MinGW ARM64 BenchmarkDirectCall 0.589 ns/op -0.0011 ns/op / -0.2% (better)
Windows MinGW ARM64 BenchmarkGlobalRead 0.737 ns/op -0.0004 ns/op / -0.1% (better)
Windows MinGW ARM64 BenchmarkGlobalWrite 0.590 ns/op +0.0003 ns/op / +0.1% (worse)
Windows MinGW ARM64 BenchmarkGoroutine 61981 ns/op -2414 ns/op / -3.7% (better)
Windows MinGW ARM64 BenchmarkInterfaceCall 4.158 ns/op +0.013 ns/op / +0.3% (worse)
Windows MinGW ARM64 BenchmarkRuntimeGetG 1.796 ns/op +0.003 ns/op / +0.2% (worse)
Windows MSVC BenchmarkLookupPCRandom 13.120 ns/op +0.1 ns/op / +0.8% (worse)
Windows MSVC BenchmarkMergeCompilerFlags 622.900 ns/op -10.7 ns/op / -1.7% (better)
Windows MSVC BenchmarkMergeLinkerFlags 553.300 ns/op -24.3 ns/op / -4.2% (better)
Windows MSVC BenchmarkChannelBuffered 29.520 ns/op -2.27 ns/op / -7.1% (better)
Windows MSVC BenchmarkChannelHandoff 1181 ns/op +23 ns/op / +2.0% (worse)
Windows MSVC BenchmarkDefer 54.230 ns/op -0.44 ns/op / -0.8% (better)
Windows MSVC BenchmarkDirectCall 1.549 ns/op 0 ns/op / +0.0%
Windows MSVC BenchmarkGlobalRead 1.548 ns/op -0.001 ns/op / -0.1% (better)
Windows MSVC BenchmarkGlobalWrite 2.473 ns/op +0.003 ns/op / +0.1% (worse)
Windows MSVC BenchmarkGoroutine 90518 ns/op -4237 ns/op / -4.5% (better)
Windows MSVC BenchmarkInterfaceCall 9.012 ns/op +0.019 ns/op / +0.2% (worse)
Windows MSVC BenchmarkRuntimeGetG 2.484 ns/op +0.006 ns/op / +0.2% (worse)
Windows MSVC 386 BenchmarkLookupPCRandom 26.590 ns/op -0.02 ns/op / -0.1% (better)
Windows MSVC 386 BenchmarkMergeCompilerFlags 756.100 ns/op -49.9 ns/op / -6.2% (better)
Windows MSVC 386 BenchmarkMergeLinkerFlags 658.900 ns/op -98.2 ns/op / -13.0% (better)
Windows MSVC 386 BenchmarkChannelBuffered 40.180 ns/op +0.04 ns/op / +0.1% (worse)
Windows MSVC 386 BenchmarkChannelHandoff 921.500 ns/op -29.1 ns/op / -3.1% (better)
Windows MSVC 386 BenchmarkDefer 46.970 ns/op +0.19 ns/op / +0.4% (worse)
Windows MSVC 386 BenchmarkDirectCall 1.558 ns/op +0.006 ns/op / +0.4% (worse)
Windows MSVC 386 BenchmarkGlobalRead 1.552 ns/op -0.011 ns/op / -0.7% (better)
Windows MSVC 386 BenchmarkGlobalWrite 7.789 ns/op -0.051 ns/op / -0.7% (better)
Windows MSVC 386 BenchmarkGoroutine 115793 ns/op +5446 ns/op / +4.9% (worse)
Windows MSVC 386 BenchmarkInterfaceCall 8.382 ns/op +0.009 ns/op / +0.1% (worse)
Windows MSVC 386 BenchmarkRuntimeGetG 2.481 ns/op +0.003 ns/op / +0.1% (worse)
Windows MSVC ARM64 BenchmarkLookupPCRandom 12.130 ns/op +0.05 ns/op / +0.4% (worse)
Windows MSVC ARM64 BenchmarkMergeCompilerFlags 570.100 ns/op -1.6 ns/op / -0.3% (better)
Windows MSVC ARM64 BenchmarkMergeLinkerFlags 528.500 ns/op -6.5 ns/op / -1.2% (better)
Windows MSVC ARM64 BenchmarkChannelBuffered 38.840 ns/op +2.05 ns/op / +5.6% (worse)
Windows MSVC ARM64 BenchmarkChannelHandoff 3223 ns/op -1207 ns/op / -27.2% (better)
Windows MSVC ARM64 BenchmarkDefer 65.850 ns/op -0.17 ns/op / -0.3% (better)
Windows MSVC ARM64 BenchmarkDirectCall 0.663 ns/op 0 ns/op / +0.0%
Windows MSVC ARM64 BenchmarkGlobalRead 0.590 ns/op +0.0007 ns/op / +0.1% (worse)
Windows MSVC ARM64 BenchmarkGlobalWrite 3.793 ns/op -0.003 ns/op / -0.1% (better)
Windows MSVC ARM64 BenchmarkGoroutine 59876 ns/op -186 ns/op / -0.3% (better)
Windows MSVC ARM64 BenchmarkInterfaceCall 4.139 ns/op +0.002 ns/op / +0.04834% (worse)
Windows MSVC ARM64 BenchmarkRuntimeGetG 1.804 ns/op -0.006 ns/op / -0.3% (better)
Timer runtime benchmarks
Platform Operation and runtime ns/op vs base
Linux AfterFuncZeroDelivery/Go 926 ns/op +3.6 ns/op / +0.4% (worse)
Linux AfterFuncZeroDelivery/LLGo 46833 ns/op +1781 ns/op / +4.0% (worse)
Linux CreateStop/Go 290.200 ns/op -6.8 ns/op / -2.3% (better)
Linux CreateStop/LLGo 1763 ns/op 0 ns/op / +0.0%
Linux RearmStopped/Go 116 ns/op -0.3 ns/op / -0.3% (better)
Linux RearmStopped/LLGo 1094 ns/op -279 ns/op / -20.3% (better)
Linux ResetActive/Go 69.380 ns/op +0.02 ns/op / +0.02884% (worse)
Linux ResetActive/LLGo 765.700 ns/op +74.1 ns/op / +10.7% (worse)
Linux ResetHeap1024/Go 67.230 ns/op -0.01 ns/op / -0.01487% (better)
Linux ResetHeap1024/LLGo 162.400 ns/op +1.4 ns/op / +0.9% (worse)
macOS AfterFuncZeroDelivery/Go 580.400 ns/op -20.1 ns/op / -3.3% (better)
macOS AfterFuncZeroDelivery/LLGo 41409 ns/op -13016 ns/op / -23.9% (better)
macOS CreateStop/Go 178.900 ns/op -11.2 ns/op / -5.9% (better)
macOS CreateStop/LLGo 555.100 ns/op -164.8 ns/op / -22.9% (better)
macOS RearmStopped/Go 70.650 ns/op -5.96 ns/op / -7.8% (better)
macOS RearmStopped/LLGo 301.400 ns/op -22.4 ns/op / -6.9% (better)
macOS ResetActive/Go 52.330 ns/op -0.1 ns/op / -0.2% (better)
macOS ResetActive/LLGo 144.800 ns/op -9.9 ns/op / -6.4% (better)
macOS ResetHeap1024/Go 45.410 ns/op -7.73 ns/op / -14.5% (better)
macOS ResetHeap1024/LLGo 77.870 ns/op -5.92 ns/op / -7.1% (better)
Windows MinGW AfterFuncZeroDelivery/Go 398.300 ns/op +20.1 ns/op / +5.3% (worse)
Windows MinGW AfterFuncZeroDelivery/LLGo 111068 ns/op +1960 ns/op / +1.8% (worse)
Windows MinGW CreateStop/Go 88.860 ns/op -1.04 ns/op / -1.2% (better)
Windows MinGW CreateStop/LLGo 335.100 ns/op -20.2 ns/op / -5.7% (better)
Windows MinGW RearmStopped/Go 24.450 ns/op 0 ns/op / +0.0%
Windows MinGW RearmStopped/LLGo 202.800 ns/op -1.7 ns/op / -0.8% (better)
Windows MinGW ResetActive/Go 14.780 ns/op -0.02 ns/op / -0.1% (better)
Windows MinGW ResetActive/LLGo 120.400 ns/op -2.5 ns/op / -2.0% (better)
Windows MinGW ResetHeap1024/Go 14.980 ns/op +0.2 ns/op / +1.4% (worse)
Windows MinGW ResetHeap1024/LLGo 106.200 ns/op -4 ns/op / -3.6% (better)
Windows MinGW 386 AfterFuncZeroDelivery/Go 763 ns/op -9.6 ns/op / -1.2% (better)
Windows MinGW 386 AfterFuncZeroDelivery/LLGo 126977 ns/op -52 ns/op / -0.04094% (better)
Windows MinGW 386 CreateStop/Go 166.400 ns/op -2.2 ns/op / -1.3% (better)
Windows MinGW 386 CreateStop/LLGo 370.800 ns/op +1.3 ns/op / +0.4% (worse)
Windows MinGW 386 RearmStopped/Go 56.930 ns/op +0.18 ns/op / +0.3% (worse)
Windows MinGW 386 RearmStopped/LLGo 245.700 ns/op +2.1 ns/op / +0.9% (worse)
Windows MinGW 386 ResetActive/Go 32.530 ns/op -0.05 ns/op / -0.2% (better)
Windows MinGW 386 ResetActive/LLGo 829.800 ns/op -2.9 ns/op / -0.3% (better)
Windows MinGW 386 ResetHeap1024/Go 32.820 ns/op +0.08 ns/op / +0.2% (worse)
Windows MinGW 386 ResetHeap1024/LLGo 140.500 ns/op +0.2 ns/op / +0.1% (worse)
Windows MinGW ARM64 AfterFuncZeroDelivery/Go 664.300 ns/op +2.2 ns/op / +0.3% (worse)
Windows MinGW ARM64 AfterFuncZeroDelivery/LLGo 147314 ns/op -5150 ns/op / -3.4% (better)
Windows MinGW ARM64 CreateStop/Go 195.200 ns/op -4.7 ns/op / -2.4% (better)
Windows MinGW ARM64 CreateStop/LLGo 356.100 ns/op +30.5 ns/op / +9.4% (worse)
Windows MinGW ARM64 RearmStopped/Go 70.580 ns/op +0.03 ns/op / +0.04252% (worse)
Windows MinGW ARM64 RearmStopped/LLGo 211.200 ns/op -5.2 ns/op / -2.4% (better)
Windows MinGW ARM64 ResetActive/Go 31.020 ns/op -0.09 ns/op / -0.3% (better)
Windows MinGW ARM64 ResetActive/LLGo 110.100 ns/op -6.6 ns/op / -5.7% (better)
Windows MinGW ARM64 ResetHeap1024/Go 31.130 ns/op +0.02 ns/op / +0.1% (worse)
Windows MinGW ARM64 ResetHeap1024/LLGo 111.500 ns/op -0.3 ns/op / -0.3% (better)
Windows MSVC AfterFuncZeroDelivery/Go 578.100 ns/op +28 ns/op / +5.1% (worse)
Windows MSVC AfterFuncZeroDelivery/LLGo 177633 ns/op +283 ns/op / +0.2% (worse)
Windows MSVC CreateStop/Go 115.600 ns/op -0.1 ns/op / -0.1% (better)
Windows MSVC CreateStop/LLGo 424.300 ns/op -14.4 ns/op / -3.3% (better)
Windows MSVC RearmStopped/Go 31.670 ns/op -0.04 ns/op / -0.1% (better)
Windows MSVC RearmStopped/LLGo 249.300 ns/op -0.3 ns/op / -0.1% (better)
Windows MSVC ResetActive/Go 20.250 ns/op +0.16 ns/op / +0.8% (worse)
Windows MSVC ResetActive/LLGo 145 ns/op -11.3 ns/op / -7.2% (better)
Windows MSVC ResetHeap1024/Go 20.390 ns/op -0.11 ns/op / -0.5% (better)
Windows MSVC ResetHeap1024/LLGo 117.700 ns/op +0.6 ns/op / +0.5% (worse)
Windows MSVC 386 AfterFuncZeroDelivery/Go 961.600 ns/op +6.3 ns/op / +0.7% (worse)
Windows MSVC 386 AfterFuncZeroDelivery/LLGo 205973 ns/op -3626 ns/op / -1.7% (better)
Windows MSVC 386 CreateStop/Go 196.600 ns/op +4.8 ns/op / +2.5% (worse)
Windows MSVC 386 CreateStop/LLGo 447 ns/op +12.4 ns/op / +2.9% (worse)
Windows MSVC 386 RearmStopped/Go 63.310 ns/op +0.05 ns/op / +0.1% (worse)
Windows MSVC 386 RearmStopped/LLGo 306.500 ns/op -5.9 ns/op / -1.9% (better)
Windows MSVC 386 ResetActive/Go 39.020 ns/op +0.06 ns/op / +0.2% (worse)
Windows MSVC 386 ResetActive/LLGo 912.400 ns/op -55.6 ns/op / -5.7% (better)
Windows MSVC 386 ResetHeap1024/Go 39.520 ns/op +0.14 ns/op / +0.4% (worse)
Windows MSVC 386 ResetHeap1024/LLGo 162.900 ns/op +3.7 ns/op / +2.3% (worse)
Windows MSVC ARM64 AfterFuncZeroDelivery/Go 655.100 ns/op -20.9 ns/op / -3.1% (better)
Windows MSVC ARM64 AfterFuncZeroDelivery/LLGo 150431 ns/op -1027 ns/op / -0.7% (better)
Windows MSVC ARM64 CreateStop/Go 197.400 ns/op -0.8 ns/op / -0.4% (better)
Windows MSVC ARM64 CreateStop/LLGo 345.400 ns/op +9.4 ns/op / +2.8% (worse)
Windows MSVC ARM64 RearmStopped/Go 70.580 ns/op +0.04 ns/op / +0.1% (worse)
Windows MSVC ARM64 RearmStopped/LLGo 224.900 ns/op -0.7 ns/op / -0.3% (better)
Windows MSVC ARM64 ResetActive/Go 31.130 ns/op -0.03 ns/op / -0.1% (better)
Windows MSVC ARM64 ResetActive/LLGo 108.200 ns/op +1.6 ns/op / +1.5% (worse)
Windows MSVC ARM64 ResetHeap1024/Go 31.140 ns/op -0.08 ns/op / -0.3% (better)
Windows MSVC ARM64 ResetHeap1024/LLGo 117 ns/op -0.7 ns/op / -0.6% (better)

Compared with 2905593ea979 measured in the same runner job.

@xushiwei
xushiwei merged commit 6413f9c into xgo-dev:main Oct 20, 2026
136 of 137 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