Skip to content

crosscompile: compile embedded library sources in parallel - #2898

Open
cpunion wants to merge 5 commits into
xgo-dev:mainfrom
cpunion:codex/crosscompile-parallel-libraries-20261021
Open

cpunion wants to merge 5 commits into
xgo-dev:mainfrom
cpunion:codex/crosscompile-parallel-libraries-20261021

Conversation

@cpunion

@cpunion cpunion commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Cold embedded builds compile newlib, picolibc and compiler-rt sources serially. Compile each library with at most min(GOMAXPROCS, 4) Clang processes, preserving archive member order and unique object names. Stop assigning work after failure, drain active compiles before cleanup, and buffer each compiler's diagnostics.

Final CI comparison: main c171abfa versus this PR's 0bf4ad51, excluding queueing:

Metric Main PR Change
Board build steps, combined 32:00 19:42 −38.4%
Board jobs, combined 35:15 24:56 −29.3%
Longest board job 18:36 14:43 −20.9%
All 11 comparable workflows 17:31:21 19:06:04 +9.0%

Board sources: main, PR. The two board jobs retain the same matrix and Qiniu runner labels. These are single CI samples with variable setup/cache/download conditions. The full-run total excludes Baseline benchmarks because PRs measure base and head while main push measures one revision; Installer shells did not run for this PR. Board builds improve, but overall CI execution time has not improved in this sample. Combined gains with #2896 remain unmeasured.

Local cold ESP32 + ESP32-C3 library builds (macOS arm64, Go 1.27.0, Espressif Clang 22.1.4, GOMAXPROCS=4): serial samples 102.14s / 105.53s, final buffered parallel samples 44.85s / 34.02s. All four runs compile the same 2,447 sources with identical normalized arguments. Parallel builds use more simultaneous CPU and memory; cached libraries bypass this work.

The macOS core suite also exposed a native callback store overwriting adjacent C memory. Include the focused one-pointer store fix from #2895/#2896, with adjacent-slot, closure-rejection, and eight-target IR regressions.

Validation: macOS full crosscompile race suite and Linux amd64 compile race suite; failure draining/cleanup, archive order, duplicate basenames, and archive linking/execution; callback tests repeated 20 times on macOS and eight-target IR checks. No existing tests or matrix entries are removed. Final CI: 114 checks passed, two conditionally skipped.

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.87234% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/crosscompile/compile/compile.go 97.61% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@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: parallelize C/asm compilation within a compile group

The parallelization is well-executed and correct. I looked closely at the concurrency:

  • No data races. Each worker writes a distinct, pre-sized objFiles[index]; cfg is copied by value into each clang.NewCompiler, and its slices are only read (mergeCompilerFlags appends into fresh slices). next/firstErr are consistently mutex-guarded, and workers.Wait() establishes the happens-before needed for the archive step.
  • Source order preserved. Writing at the original index keeps archive member order independent of completion order — relevant for duplicate-symbol resolution — and is covered by the new ordering test.
  • Clean lifecycle. workers.Wait() joins all in-flight compiles before the caller's defer os.RemoveAll(tmpCompileDir) runs, so no worker can write into a removed temp dir. count == 0 spawns zero workers and returns nil.
  • Tests are a highlight. The testing/synctest tests assert the exact worker-pool bounds and failure-join behavior deterministically, without sleeps or wall-clock thresholds.

Two inline notes below (worker cap, interleaved output). Minor/optional items:

  • The objFiles comment explains ordering but not the concurrency invariant (each index is written by exactly one worker, and the backing array is never resized). A one-line note there would keep a future maintainer from "fixing" a perceived concurrent-write race.
  • The new integration tests hard-depend on clang/llvm-ar/llvm-nm and will fail (rather than t.Skip) when the toolchain is absent. This matches the existing tests in this package, so it's a pre-existing pattern, not a regression.
  • Out of scope, as context for the throughput goal: groups are still compiled sequentially, so a config of many small groups never exceeds the per-group cap in aggregate.

Comment thread internal/crosscompile/compile/compile.go Outdated
Comment thread internal/crosscompile/compile/compile.go
Reuse the callback-store fix from c87f706 in PR xgo-dev#2895 without the unrelated linkname changes. Clearing or restoring a C callback must not write a two-word Go funcval over adjacent native storage.

Add deterministic adjacent-slot and closure-rejection regressions, plus pointer-width IR checks on Linux, Darwin and all six Windows ABI targets.
@cpunion

cpunion commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator Author

Added the requested concurrency invariant beside objFiles in 0bf4ad5: each worker owns one distinct index, the backing array is never resized, and the archive reads it only after all workers join. The existing worker cap and per-compile buffered diagnostics already address the other review notes.

Validation is complete for 0bf4ad5: 114 checks succeeded. Tag-only publishing and the unchanged-documentation link check were skipped by their workflow conditions.

@github-actions

Copy link
Copy Markdown

LLGo baseline benchmarks

0bf4ad51631f | 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% 1.030 s +41.65 ms / +4.2% (worse) 1.380 ms +85.57 us / +6.6% (worse)
Linux cprintf-lto 8120 B 0 B / +0.0% 368 B 0 B / +0.0% 990.028 ms +24.74 ms / +2.6% (worse) 1.321 ms -108.8 us / -7.6% (better)
Linux fmtprintf 2565720 B +96 B / +0.003742% (worse) 511606 B 0 B / +0.0% 6.046 s -163.8 ms / -2.6% (better) 4.647 ms +626.7 us / +15.6% (worse)
Linux fmtprintf-lto 2008104 B -112 B / -0.005577% (better) 448627 B 0 B / +0.0% 26.694 s -700.1 ms / -2.6% (better) 3.855 ms +19.96 us / +0.5% (worse)
Linux println 246128 B +72 B / +0.02926% (worse) 17756 B 0 B / +0.0% 1.108 s +25.53 ms / +2.4% (worse) 1.913 ms +221.7 us / +13.1% (worse)
Linux println-lto 97056 B +16 B / +0.01649% (worse) 15021 B 0 B / +0.0% 1.885 s +62.55 ms / +3.4% (worse) 1.706 ms +15.61 us / +0.9% (worse)
macOS cprintf 50672 B 0 B / +0.0% 4409 B 0 B / +0.0% 1.280 s -584.7 ms / -31.3% (better) 3.634 ms -1.508 ms / -29.3% (better)
macOS cprintf-lto 50592 B -16 B / -0.03162% (better) 161 B 0 B / +0.0% 1.819 s +355.2 ms / +24.3% (worse) 3.963 ms -1.067 ms / -21.2% (better)
macOS fmtprintf 1687568 B +16 B / +0.0009481% (worse) 892440 B 0 B / +0.0% 5.107 s -1.136 s / -18.2% (better) 31.014 ms -75.41 ms / -70.9% (better)
macOS fmtprintf-lto 1405232 B 0 B / +0.0% 774684 B 0 B / +0.0% 9.636 s -3.378 s / -26.0% (better) 48.617 ms -118.4 ms / -70.9% (better)
macOS println 96960 B 0 B / +0.0% 24707 B 0 B / +0.0% 1.062 s -731.1 ms / -40.8% (better) 4.227 ms -4.256 ms / -50.2% (better)
macOS println-lto 84288 B 0 B / +0.0% 21864 B 0 B / +0.0% 1.364 s -341.2 ms / -20.0% (better) 6.051 ms +221.1 us / +3.8% (worse)
Windows MinGW cprintf 709632 B 0 B / +0.0% 4390 B 0 B / +0.0% 1.569 s +19.56 ms / +1.3% (worse) 2.913 ms +115.1 us / +4.1% (worse)
Windows MinGW cprintf-lto 59392 B 0 B / +0.0% 4342 B 0 B / +0.0% 1.537 s -29.63 ms / -1.9% (better) 2.828 ms +57.6 us / +2.1% (worse)
Windows MinGW fmtprintf 5588480 B 0 B / +0.0% 609462 B 0 B / +0.0% 4.580 s -200.4 ms / -4.2% (better) 9.374 ms -65.2 us / -0.7% (better)
Windows MinGW fmtprintf-lto 4232192 B 0 B / +0.0% 556838 B 0 B / +0.0% 11.254 s +23.12 ms / +0.2% (worse) 8.729 ms -288.7 us / -3.2% (better)
Windows MinGW println 766976 B 0 B / +0.0% 25510 B 0 B / +0.0% 4.876 s +3.288 s / +207.0% (worse) 5.256 ms -373.5 us / -6.6% (better)
Windows MinGW println-lto 222208 B 0 B / +0.0% 22278 B 0 B / +0.0% 1.760 s -10.17 ms / -0.6% (better) 4.948 ms -1.138 ms / -18.7% (better)
Windows MinGW 386 cprintf 657920 B 0 B / +0.0% 5608 B 0 B / +0.0% 2.136 s -44.59 ms / -2.0% (better) 7.087 ms -586 us / -7.6% (better)
Windows MinGW 386 cprintf-lto 119296 B 0 B / +0.0% 5112 B 0 B / +0.0% 2.176 s -60.88 ms / -2.7% (better) 7.115 ms -778.6 us / -9.9% (better)
Windows MinGW 386 fmtprintf 4884992 B 0 B / +0.0% 476862 B 0 B / +0.0% 6.790 s +23.78 ms / +0.4% (worse) 14.605 ms -1.303 ms / -8.2% (better)
Windows MinGW 386 fmtprintf-lto 4233728 B 0 B / +0.0% 455182 B 0 B / +0.0% 15.689 s +235.6 ms / +1.5% (worse) 16.968 ms -296 us / -1.7% (better)
Windows MinGW 386 println 711680 B 0 B / +0.0% 22116 B 0 B / +0.0% 2.266 s +82.53 ms / +3.8% (worse) 11.061 ms -439.8 us / -3.8% (better)
Windows MinGW 386 println-lto 271872 B 0 B / +0.0% 19628 B 0 B / +0.0% 2.510 s -34.79 ms / -1.4% (better) 10.809 ms -948.3 us / -8.1% (better)
Windows MinGW ARM64 cprintf 720896 B 0 B / +0.0% 4204 B 0 B / +0.0% 1.920 s -119.3 ms / -5.9% (better) 5.708 ms -455.3 us / -7.4% (better)
Windows MinGW ARM64 cprintf-lto 58880 B 0 B / +0.0% 4156 B 0 B / +0.0% 1.962 s -988.2 ms / -33.5% (better) 5.856 ms -3.088 ms / -34.5% (better)
Windows MinGW ARM64 fmtprintf 5498368 B 0 B / +0.0% 517620 B 0 B / +0.0% 5.209 s -172.7 ms / -3.2% (better) 14.877 ms +727.9 us / +5.1% (worse)
Windows MinGW ARM64 fmtprintf-lto 4398592 B 0 B / +0.0% 483424 B 0 B / +0.0% 11.709 s -42.88 ms / -0.4% (better) 13.610 ms -1.013 ms / -6.9% (better)
Windows MinGW ARM64 println 773632 B 0 B / +0.0% 24152 B 0 B / +0.0% 1.903 s -247.7 ms / -11.5% (better) 10.033 ms -775.2 us / -7.2% (better)
Windows MinGW ARM64 println-lto 228352 B 0 B / +0.0% 21404 B 0 B / +0.0% 2.194 s -45.13 ms / -2.0% (better) 10.064 ms -536.9 us / -5.1% (better)
Windows MSVC cprintf 954368 B 0 B / +0.0% 66003 B 0 B / +0.0% 1.819 s +7.328 ms / +0.4% (worse) 3.353 ms +160.3 us / +5.0% (worse)
Windows MSVC cprintf-lto 307200 B 0 B / +0.0% 65971 B 0 B / +0.0% 1.850 s -26.11 ms / -1.4% (better) 3.921 ms +406.8 us / +11.6% (worse)
Windows MSVC fmtprintf 5890560 B 0 B / +0.0% 705350 B 0 B / +0.0% 5.619 s +71.19 ms / +1.3% (worse) 12.016 ms -391.6 us / -3.2% (better)
Windows MSVC fmtprintf-lto 4556288 B 0 B / +0.0% 656486 B 0 B / +0.0% 12.383 s -33.16 ms / -0.3% (better) 12.772 ms +995.7 us / +8.5% (worse)
Windows MSVC println 1079808 B 0 B / +0.0% 121542 B 0 B / +0.0% 1.796 s -95.51 ms / -5.1% (better) 7.477 ms -638 us / -7.9% (better)
Windows MSVC println-lto 542720 B 0 B / +0.0% 118982 B 0 B / +0.0% 2.113 s +6.891 ms / +0.3% (worse) 7.559 ms -621.5 us / -7.6% (better)
Windows MSVC 386 cprintf 566784 B 0 B / +0.0% 3947 B 0 B / +0.0% 1.717 s -42.52 ms / -2.4% (better) 5.524 ms -169 us / -3.0% (better)
Windows MSVC 386 cprintf-lto 59904 B 0 B / +0.0% 3901 B 0 B / +0.0% 1.757 s -6.621 ms / -0.4% (better) 5.443 ms +326.1 us / +6.4% (worse)
Windows MSVC 386 fmtprintf 4615680 B 0 B / +0.0% 460274 B 0 B / +0.0% 5.476 s -40.26 ms / -0.7% (better) 13.339 ms -3.408 ms / -20.3% (better)
Windows MSVC 386 fmtprintf-lto 3980288 B 0 B / +0.0% 430529 B 0 B / +0.0% 11.815 s -37.92 ms / -0.3% (better) 13.763 ms +149.1 us / +1.1% (worse)
Windows MSVC 386 println 623104 B 0 B / +0.0% 20716 B 0 B / +0.0% 1.732 s -232.4 ms / -11.8% (better) 9.836 ms +317.4 us / +3.3% (worse)
Windows MSVC 386 println-lto 210944 B 0 B / +0.0% 18829 B 0 B / +0.0% 1.972 s -7.992 ms / -0.4% (better) 9.136 ms -314 us / -3.3% (better)
Windows MSVC ARM64 cprintf 720384 B 0 B / +0.0% 4240 B 0 B / +0.0% 1.911 s +82.83 ms / +4.5% (worse) 7.465 ms +1 ms / +15.5% (worse)
Windows MSVC ARM64 cprintf-lto 64512 B 0 B / +0.0% 4140 B 0 B / +0.0% 1.939 s +63.97 ms / +3.4% (worse) 7.324 ms +181.7 us / +2.5% (worse)
Windows MSVC ARM64 fmtprintf 5494784 B 0 B / +0.0% 517716 B 0 B / +0.0% 5.462 s +106 ms / +2.0% (worse) 17.690 ms +1.218 ms / +7.4% (worse)
Windows MSVC ARM64 fmtprintf-lto 4405760 B 0 B / +0.0% 484240 B 0 B / +0.0% 12.054 s +383.1 ms / +3.3% (worse) 19.315 ms +2.533 ms / +15.1% (worse)
Windows MSVC ARM64 println 775680 B 0 B / +0.0% 24420 B 0 B / +0.0% 1.917 s +91.48 ms / +5.0% (worse) 13.105 ms +1.495 ms / +12.9% (worse)
Windows MSVC ARM64 println-lto 233472 B 0 B / +0.0% 21796 B 0 B / +0.0% 2.168 s +110.4 ms / +5.4% (worse) 13.021 ms +1.296 ms / +11.1% (worse)
Core language and compiler benchmarks
Platform Benchmark ns/op vs base
Linux BenchmarkLookupPCRandom 14.970 ns/op +0.06 ns/op / +0.4% (worse)
Linux BenchmarkMergeCompilerFlags 203.400 ns/op -2 ns/op / -1.0% (better)
Linux BenchmarkMergeLinkerFlags 138.300 ns/op +4.6 ns/op / +3.4% (worse)
Linux BenchmarkChannelBuffered 60.540 ns/op +1.81 ns/op / +3.1% (worse)
Linux BenchmarkChannelHandoff 16424 ns/op +2450 ns/op / +17.5% (worse)
Linux BenchmarkDefer 63.060 ns/op +5.75 ns/op / +10.0% (worse)
Linux BenchmarkDirectCall 1.186 ns/op +0.017 ns/op / +1.5% (worse)
Linux BenchmarkGlobalRead 1.174 ns/op -0.018 ns/op / -1.5% (better)
Linux BenchmarkGlobalWrite 7.804 ns/op +0.001 ns/op / +0.01282% (worse)
Linux BenchmarkGoroutine 34083 ns/op +8225 ns/op / +31.8% (worse)
Linux BenchmarkInterfaceCall 5.854 ns/op -0.008 ns/op / -0.1% (better)
Linux BenchmarkRuntimeGetG 2.351 ns/op -0.044 ns/op / -1.8% (better)
macOS BenchmarkLookupPCRandom 15.040 ns/op -0.61 ns/op / -3.9% (better)
macOS BenchmarkMergeCompilerFlags 212.600 ns/op +57.6 ns/op / +37.2% (worse)
macOS BenchmarkMergeLinkerFlags 103 ns/op +13.44 ns/op / +15.0% (worse)
macOS BenchmarkChannelBuffered 30.240 ns/op -10.49 ns/op / -25.8% (better)
macOS BenchmarkChannelHandoff 9921 ns/op -4136 ns/op / -29.4% (better)
macOS BenchmarkDefer 38.710 ns/op -12.55 ns/op / -24.5% (better)
macOS BenchmarkDirectCall 1.280 ns/op -0.208 ns/op / -14.0% (better)
macOS BenchmarkGlobalRead 1.097 ns/op -0.818 ns/op / -42.7% (better)
macOS BenchmarkGlobalWrite 1.052 ns/op -0.488 ns/op / -31.7% (better)
macOS BenchmarkGoroutine 65950 ns/op +14322 ns/op / +27.7% (worse)
macOS BenchmarkInterfaceCall 4.076 ns/op -1.411 ns/op / -25.7% (better)
macOS BenchmarkRuntimeGetG 2.869 ns/op -0.019 ns/op / -0.7% (better)
Windows MinGW BenchmarkLookupPCRandom 9.676 ns/op -0.046 ns/op / -0.5% (better)
Windows MinGW BenchmarkMergeCompilerFlags 369.900 ns/op -46.6 ns/op / -11.2% (better)
Windows MinGW BenchmarkMergeLinkerFlags 331.900 ns/op -14.3 ns/op / -4.1% (better)
Windows MinGW BenchmarkChannelBuffered 26.350 ns/op -0.14 ns/op / -0.5% (better)
Windows MinGW BenchmarkChannelHandoff 1122 ns/op -60 ns/op / -5.1% (better)
Windows MinGW BenchmarkDefer 42.990 ns/op +1.33 ns/op / +3.2% (worse)
Windows MinGW BenchmarkDirectCall 1.357 ns/op 0 ns/op / +0.0%
Windows MinGW BenchmarkGlobalRead 1.358 ns/op +0.001 ns/op / +0.1% (worse)
Windows MinGW BenchmarkGlobalWrite 2.165 ns/op +0.002 ns/op / +0.1% (worse)
Windows MinGW BenchmarkGoroutine 59366 ns/op -1699 ns/op / -2.8% (better)
Windows MinGW BenchmarkInterfaceCall 6.789 ns/op -0.002 ns/op / -0.02945% (better)
Windows MinGW BenchmarkRuntimeGetG 1.902 ns/op -0.002 ns/op / -0.1% (better)
Windows MinGW 386 BenchmarkLookupPCRandom 26.700 ns/op +0.13 ns/op / +0.5% (worse)
Windows MinGW 386 BenchmarkMergeCompilerFlags 810.700 ns/op -6.3 ns/op / -0.8% (better)
Windows MinGW 386 BenchmarkMergeLinkerFlags 733.600 ns/op +6.8 ns/op / +0.9% (worse)
Windows MinGW 386 BenchmarkChannelBuffered 41.970 ns/op +0.16 ns/op / +0.4% (worse)
Windows MinGW 386 BenchmarkChannelHandoff 944.700 ns/op +51.9 ns/op / +5.8% (worse)
Windows MinGW 386 BenchmarkDefer 50.910 ns/op -0.91 ns/op / -1.8% (better)
Windows MinGW 386 BenchmarkDirectCall 1.552 ns/op +0.001 ns/op / +0.1% (worse)
Windows MinGW 386 BenchmarkGlobalRead 1.551 ns/op -0.004 ns/op / -0.3% (better)
Windows MinGW 386 BenchmarkGlobalWrite 7.783 ns/op -0.002 ns/op / -0.02569% (better)
Windows MinGW 386 BenchmarkGoroutine 109884 ns/op -2654 ns/op / -2.4% (better)
Windows MinGW 386 BenchmarkInterfaceCall 8.394 ns/op +0.026 ns/op / +0.3% (worse)
Windows MinGW 386 BenchmarkRuntimeGetG 2.483 ns/op +0.001 ns/op / +0.04029% (worse)
Windows MinGW ARM64 BenchmarkLookupPCRandom 12.100 ns/op +0.07 ns/op / +0.6% (worse)
Windows MinGW ARM64 BenchmarkMergeCompilerFlags 568.100 ns/op -5.7 ns/op / -1.0% (better)
Windows MinGW ARM64 BenchmarkMergeLinkerFlags 524.200 ns/op +6.3 ns/op / +1.2% (worse)
Windows MinGW ARM64 BenchmarkChannelBuffered 38.400 ns/op +0.18 ns/op / +0.5% (worse)
Windows MinGW ARM64 BenchmarkChannelHandoff 3466 ns/op +729 ns/op / +26.6% (worse)
Windows MinGW ARM64 BenchmarkDefer 51.140 ns/op +2.07 ns/op / +4.2% (worse)
Windows MinGW ARM64 BenchmarkDirectCall 0.590 ns/op 0 ns/op / +0.0%
Windows MinGW ARM64 BenchmarkGlobalRead 0.737 ns/op -0.0002 ns/op / -0.02714% (better)
Windows MinGW ARM64 BenchmarkGlobalWrite 0.590 ns/op +0.0002 ns/op / +0.03393% (worse)
Windows MinGW ARM64 BenchmarkGoroutine 64602 ns/op +6373 ns/op / +10.9% (worse)
Windows MinGW ARM64 BenchmarkInterfaceCall 4.233 ns/op +0.005 ns/op / +0.1% (worse)
Windows MinGW ARM64 BenchmarkRuntimeGetG 1.801 ns/op +0.031 ns/op / +1.8% (worse)
Windows MSVC BenchmarkLookupPCRandom 13.220 ns/op +0.39 ns/op / +3.0% (worse)
Windows MSVC BenchmarkMergeCompilerFlags 607.300 ns/op -21 ns/op / -3.3% (better)
Windows MSVC BenchmarkMergeLinkerFlags 553 ns/op -0.8 ns/op / -0.1% (better)
Windows MSVC BenchmarkChannelBuffered 34.270 ns/op +0.19 ns/op / +0.6% (worse)
Windows MSVC BenchmarkChannelHandoff 1326 ns/op +29 ns/op / +2.2% (worse)
Windows MSVC BenchmarkDefer 53.240 ns/op +0.09 ns/op / +0.2% (worse)
Windows MSVC BenchmarkDirectCall 1.548 ns/op -0.001 ns/op / -0.1% (better)
Windows MSVC BenchmarkGlobalRead 1.547 ns/op 0 ns/op / +0.0%
Windows MSVC BenchmarkGlobalWrite 2.473 ns/op +0.001 ns/op / +0.04045% (worse)
Windows MSVC BenchmarkGoroutine 90575 ns/op +2597 ns/op / +3.0% (worse)
Windows MSVC BenchmarkInterfaceCall 8.821 ns/op +0.139 ns/op / +1.6% (worse)
Windows MSVC BenchmarkRuntimeGetG 2.170 ns/op +0.004 ns/op / +0.2% (worse)
Windows MSVC 386 BenchmarkLookupPCRandom 26.590 ns/op +0.12 ns/op / +0.5% (worse)
Windows MSVC 386 BenchmarkMergeCompilerFlags 768.600 ns/op -0.8 ns/op / -0.1% (better)
Windows MSVC 386 BenchmarkMergeLinkerFlags 727.600 ns/op +40 ns/op / +5.8% (worse)
Windows MSVC 386 BenchmarkChannelBuffered 41.660 ns/op -0.03 ns/op / -0.1% (better)
Windows MSVC 386 BenchmarkChannelHandoff 1075 ns/op -36 ns/op / -3.2% (better)
Windows MSVC 386 BenchmarkDefer 45.900 ns/op -5.06 ns/op / -9.9% (better)
Windows MSVC 386 BenchmarkDirectCall 1.550 ns/op +0.002 ns/op / +0.1% (worse)
Windows MSVC 386 BenchmarkGlobalRead 1.550 ns/op 0 ns/op / +0.0%
Windows MSVC 386 BenchmarkGlobalWrite 7.770 ns/op -0.018 ns/op / -0.2% (better)
Windows MSVC 386 BenchmarkGoroutine 109104 ns/op +1016 ns/op / +0.9% (worse)
Windows MSVC 386 BenchmarkInterfaceCall 8.270 ns/op +0.012 ns/op / +0.1% (worse)
Windows MSVC 386 BenchmarkRuntimeGetG 2.479 ns/op +0.002 ns/op / +0.1% (worse)
Windows MSVC ARM64 BenchmarkLookupPCRandom 12.180 ns/op +0.04 ns/op / +0.3% (worse)
Windows MSVC ARM64 BenchmarkMergeCompilerFlags 625.500 ns/op +58.6 ns/op / +10.3% (worse)
Windows MSVC ARM64 BenchmarkMergeLinkerFlags 568.300 ns/op +28.1 ns/op / +5.2% (worse)
Windows MSVC ARM64 BenchmarkChannelBuffered 37.770 ns/op +0.07 ns/op / +0.2% (worse)
Windows MSVC ARM64 BenchmarkChannelHandoff 2847 ns/op +238 ns/op / +9.1% (worse)
Windows MSVC ARM64 BenchmarkDefer 64.440 ns/op +0.44 ns/op / +0.7% (worse)
Windows MSVC ARM64 BenchmarkDirectCall 0.663 ns/op -0.0006 ns/op / -0.1% (better)
Windows MSVC ARM64 BenchmarkGlobalRead 0.590 ns/op -0.0001 ns/op / -0.01695% (better)
Windows MSVC ARM64 BenchmarkGlobalWrite 3.795 ns/op 0 ns/op / +0.0%
Windows MSVC ARM64 BenchmarkGoroutine 56756 ns/op +1015 ns/op / +1.8% (worse)
Windows MSVC ARM64 BenchmarkInterfaceCall 4.161 ns/op -0.004 ns/op / -0.1% (better)
Windows MSVC ARM64 BenchmarkRuntimeGetG 1.770 ns/op -0.011 ns/op / -0.6% (better)
Timer runtime benchmarks
Platform Operation and runtime ns/op vs base
Linux AfterFuncZeroDelivery/Go 929.900 ns/op +4.9 ns/op / +0.5% (worse)
Linux AfterFuncZeroDelivery/LLGo 39284 ns/op -3338 ns/op / -7.8% (better)
Linux CreateStop/Go 302.100 ns/op -13.2 ns/op / -4.2% (better)
Linux CreateStop/LLGo 1891 ns/op -40 ns/op / -2.1% (better)
Linux RearmStopped/Go 116.100 ns/op -0.2 ns/op / -0.2% (better)
Linux RearmStopped/LLGo 1399 ns/op +61 ns/op / +4.6% (worse)
Linux ResetActive/Go 68.680 ns/op +0.05 ns/op / +0.1% (worse)
Linux ResetActive/LLGo 732.700 ns/op +22.2 ns/op / +3.1% (worse)
Linux ResetHeap1024/Go 67.770 ns/op +0.46 ns/op / +0.7% (worse)
Linux ResetHeap1024/LLGo 166.600 ns/op +0.8 ns/op / +0.5% (worse)
macOS AfterFuncZeroDelivery/Go 590.100 ns/op -191.5 ns/op / -24.5% (better)
macOS AfterFuncZeroDelivery/LLGo 64558 ns/op +558 ns/op / +0.9% (worse)
macOS CreateStop/Go 174.100 ns/op +1.2 ns/op / +0.7% (worse)
macOS CreateStop/LLGo 635.800 ns/op -274.4 ns/op / -30.1% (better)
macOS RearmStopped/Go 64.930 ns/op -27.81 ns/op / -30.0% (better)
macOS RearmStopped/LLGo 463 ns/op +31.4 ns/op / +7.3% (worse)
macOS ResetActive/Go 52.350 ns/op -3.28 ns/op / -5.9% (better)
macOS ResetActive/LLGo 206.900 ns/op -14.7 ns/op / -6.6% (better)
macOS ResetHeap1024/Go 57.060 ns/op -7.92 ns/op / -12.2% (better)
macOS ResetHeap1024/LLGo 135.400 ns/op +53.23 ns/op / +64.8% (worse)
Windows MinGW AfterFuncZeroDelivery/Go 367.700 ns/op -30.6 ns/op / -7.7% (better)
Windows MinGW AfterFuncZeroDelivery/LLGo 113923 ns/op -8710 ns/op / -7.1% (better)
Windows MinGW CreateStop/Go 92.510 ns/op +1.72 ns/op / +1.9% (worse)
Windows MinGW CreateStop/LLGo 356.300 ns/op -137.5 ns/op / -27.8% (better)
Windows MinGW RearmStopped/Go 24.450 ns/op -2.75 ns/op / -10.1% (better)
Windows MinGW RearmStopped/LLGo 198.400 ns/op +5.3 ns/op / +2.7% (worse)
Windows MinGW ResetActive/Go 14.790 ns/op -0.04 ns/op / -0.3% (better)
Windows MinGW ResetActive/LLGo 147.500 ns/op +16.5 ns/op / +12.6% (worse)
Windows MinGW ResetHeap1024/Go 14.850 ns/op -0.82 ns/op / -5.2% (better)
Windows MinGW ResetHeap1024/LLGo 101.700 ns/op -0.7 ns/op / -0.7% (better)
Windows MinGW 386 AfterFuncZeroDelivery/Go 971.400 ns/op +9.9 ns/op / +1.0% (worse)
Windows MinGW 386 AfterFuncZeroDelivery/LLGo 209951 ns/op +4291 ns/op / +2.1% (worse)
Windows MinGW 386 CreateStop/Go 199.100 ns/op -0.1 ns/op / -0.1% (better)
Windows MinGW 386 CreateStop/LLGo 536.200 ns/op +8.1 ns/op / +1.5% (worse)
Windows MinGW 386 RearmStopped/Go 63.510 ns/op +0.21 ns/op / +0.3% (worse)
Windows MinGW 386 RearmStopped/LLGo 348.700 ns/op +13.8 ns/op / +4.1% (worse)
Windows MinGW 386 ResetActive/Go 39.140 ns/op +0.03 ns/op / +0.1% (worse)
Windows MinGW 386 ResetActive/LLGo 1005 ns/op +415.1 ns/op / +70.4% (worse)
Windows MinGW 386 ResetHeap1024/Go 39.600 ns/op +0.14 ns/op / +0.4% (worse)
Windows MinGW 386 ResetHeap1024/LLGo 180.100 ns/op -0.3 ns/op / -0.2% (better)
Windows MinGW ARM64 AfterFuncZeroDelivery/Go 669.400 ns/op -6.4 ns/op / -0.9% (better)
Windows MinGW ARM64 AfterFuncZeroDelivery/LLGo 145305 ns/op +3504 ns/op / +2.5% (worse)
Windows MinGW ARM64 CreateStop/Go 197.600 ns/op +1.5 ns/op / +0.8% (worse)
Windows MinGW ARM64 CreateStop/LLGo 445.900 ns/op +19.6 ns/op / +4.6% (worse)
Windows MinGW ARM64 RearmStopped/Go 70.560 ns/op -0.06 ns/op / -0.1% (better)
Windows MinGW ARM64 RearmStopped/LLGo 226.300 ns/op +4.3 ns/op / +1.9% (worse)
Windows MinGW ARM64 ResetActive/Go 30.860 ns/op -0.31 ns/op / -1.0% (better)
Windows MinGW ARM64 ResetActive/LLGo 121.300 ns/op -6.9 ns/op / -5.4% (better)
Windows MinGW ARM64 ResetHeap1024/Go 31.050 ns/op +0.17 ns/op / +0.6% (worse)
Windows MinGW ARM64 ResetHeap1024/LLGo 112.500 ns/op -0.5 ns/op / -0.4% (better)
Windows MSVC AfterFuncZeroDelivery/Go 573.100 ns/op -2.3 ns/op / -0.4% (better)
Windows MSVC AfterFuncZeroDelivery/LLGo 178783 ns/op -771 ns/op / -0.4% (better)
Windows MSVC CreateStop/Go 115.400 ns/op -0.9 ns/op / -0.8% (better)
Windows MSVC CreateStop/LLGo 434.100 ns/op -6.8 ns/op / -1.5% (better)
Windows MSVC RearmStopped/Go 31.470 ns/op +0.04 ns/op / +0.1% (worse)
Windows MSVC RearmStopped/LLGo 265.300 ns/op +25.7 ns/op / +10.7% (worse)
Windows MSVC ResetActive/Go 20.050 ns/op -0.01 ns/op / -0.04985% (better)
Windows MSVC ResetActive/LLGo 172.400 ns/op -6.2 ns/op / -3.5% (better)
Windows MSVC ResetHeap1024/Go 20.510 ns/op +0.03 ns/op / +0.1% (worse)
Windows MSVC ResetHeap1024/LLGo 123.100 ns/op +0.3 ns/op / +0.2% (worse)
Windows MSVC 386 AfterFuncZeroDelivery/Go 952 ns/op -9.6 ns/op / -1.0% (better)
Windows MSVC 386 AfterFuncZeroDelivery/LLGo 199706 ns/op +338 ns/op / +0.2% (worse)
Windows MSVC 386 CreateStop/Go 191.400 ns/op +0.1 ns/op / +0.1% (worse)
Windows MSVC 386 CreateStop/LLGo 461 ns/op -9.6 ns/op / -2.0% (better)
Windows MSVC 386 RearmStopped/Go 63.280 ns/op -0.04 ns/op / -0.1% (better)
Windows MSVC 386 RearmStopped/LLGo 303.400 ns/op -2.5 ns/op / -0.8% (better)
Windows MSVC 386 ResetActive/Go 38.980 ns/op -0.02 ns/op / -0.1% (better)
Windows MSVC 386 ResetActive/LLGo 911.200 ns/op -27.6 ns/op / -2.9% (better)
Windows MSVC 386 ResetHeap1024/Go 39.460 ns/op +0.1 ns/op / +0.3% (worse)
Windows MSVC 386 ResetHeap1024/LLGo 165.700 ns/op -0.6 ns/op / -0.4% (better)
Windows MSVC ARM64 AfterFuncZeroDelivery/Go 685.100 ns/op +10.2 ns/op / +1.5% (worse)
Windows MSVC ARM64 AfterFuncZeroDelivery/LLGo 145093 ns/op +647 ns/op / +0.4% (worse)
Windows MSVC ARM64 CreateStop/Go 196.700 ns/op -0.9 ns/op / -0.5% (better)
Windows MSVC ARM64 CreateStop/LLGo 396.200 ns/op -16.3 ns/op / -4.0% (better)
Windows MSVC ARM64 RearmStopped/Go 70.730 ns/op +0.2 ns/op / +0.3% (worse)
Windows MSVC ARM64 RearmStopped/LLGo 233 ns/op +4.1 ns/op / +1.8% (worse)
Windows MSVC ARM64 ResetActive/Go 31.060 ns/op +0.05 ns/op / +0.2% (worse)
Windows MSVC ARM64 ResetActive/LLGo 125.200 ns/op -5 ns/op / -3.8% (better)
Windows MSVC ARM64 ResetHeap1024/Go 31.170 ns/op +0.05 ns/op / +0.2% (worse)
Windows MSVC ARM64 ResetHeap1024/LLGo 119.200 ns/op +0.4 ns/op / +0.3% (worse)

Compared with c171abfa1301 measured in the same runner job.

@github-actions

Copy link
Copy Markdown

LLGo WebAssembly build benchmarks

0bf4ad51631f | 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 149447 B 0 B / +0.0% 88541 B 0 B / +0.0%
cprintf/j32-goos-js/LLGo 148066 B 0 B / +0.0% 72985 B 0 B / +0.0%
cprintf/j64-emscripten-memory64/LLGo 136749 B 0 B / +0.0% 91712 B 0 B / +0.0%
cprintf/w32-goos-wasip1/LLGo 159710 B 0 B / +0.0% 0 B 0 B / 0.0%
cprintf/w32-wasi/LLGo 160318 B 0 B / +0.0% 0 B 0 B / 0.0%
fmtprintf/j32-emscripten/LLGo 3004237 B 0 B / +0.0% 121077 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 3100354 B 0 B / +0.0% 92140 B 0 B / +0.0%
fmtprintf/j64-emscripten-memory64/LLGo 2768379 B 0 B / +0.0% 125674 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 2374992 B 0 B / +0.0% 0 B 0 B / 0.0%
fmtprintf/w32-wasi/LLGo 2371681 B 0 B / +0.0% 0 B 0 B / 0.0%
j32-emscripten/LLGo 148964 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 147816 B 0 B / +0.0% 72985 B 0 B / +0.0%
j64-emscripten-memory64/LLGo 136307 B 0 B / +0.0% 91712 B 0 B / +0.0%
reflectcall/j32-emscripten/LLGo 1531352 B 0 B / +0.0% 95417 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 1583425 B 0 B / +0.0% 79857 B 0 B / +0.0%
reflectcall/j64-emscripten-memory64/LLGo 1411631 B 0 B / +0.0% 99170 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 1309382 B 0 B / +0.0% 0 B 0 B / 0.0%
reflectcall/w32-wasi/LLGo 1306983 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 159384 B 0 B / +0.0% 0 B 0 B / 0.0%
w32-wasi/LLGo 159992 B 0 B / +0.0% 0 B 0 B / 0.0%
LLGo WebAssembly build measurements
Example and profile Build vs base
j32-emscripten 9.232 s +277.6 ms / +3.1% (worse)
j32-goos-js 8.298 s +35.78 ms / +0.4% (worse)
j64-emscripten-memory64 7.591 s +148.1 ms / +2.0% (worse)
reflectcall/w32-wasi 26.551 s +471.8 ms / +1.8% (worse)
w32-goos-wasip1 5.267 s -65.25 ms / -1.2% (better)
w32-wasi 4.925 s -225.5 ms / -4.4% (better)

Compared with c171abfa1301 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