Skip to content

benchmark: add runtime funcinfo scaling probes#2011

Closed
cpunion wants to merge 24 commits into
xgo-dev:mainfrom
cpunion:codex/runtime-funcinfo-scaling-bench
Closed

benchmark: add runtime funcinfo scaling probes#2011
cpunion wants to merge 24 commits into
xgo-dev:mainfrom
cpunion:codex/runtime-funcinfo-scaling-bench

Conversation

@cpunion

@cpunion cpunion commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Depends on #2010.

Adds reusable scaling probes to benchmark/runtime_funcinfo so runtime funcinfo performance can be compared against Go across project sizes and cold first-use paths.

Changes

  • Add a cold scenario that measures first-use FuncForPC, Func.FileLine, runtime.Caller, and CallersFrames from a fresh process.
  • Add -scales=PxM,... to generate multiple multipkg_* and cold_* scenarios in one run.
  • Store scenario metadata in results.json, including package/function counts and target counts.
  • Document the new cold and scale semantics.

Validation

  • go test ./benchmark/runtime_funcinfo
  • Go smoke: go run ./benchmark/runtime_funcinfo -out /tmp/llgo-runtime-funcinfo-scale-smoke -runs=1 -iters=1000 -scenarios=multipkg,cold -scales=2x2,3x2 -variant go=go
  • LLGo smoke: go run ./benchmark/runtime_funcinfo -out /tmp/llgo-runtime-funcinfo-scale-llgo-smoke2 -runs=1 -iters=1000 -scenarios=cold -scales=2x2,3x2 -variant llgo=llgo,/tmp/llgo-scaling-bench,/Users/lijie/source/goplus/llgo-wt-runtime-funcinfo-scaling
  • macOS arm64 scaling run with Go 1.26.4 and runtime: speed up funcinfo hot paths #2010: -runs=5 -iters=200000 -scenarios=multipkg,cold -scales=6x6,12x12,24x24

Cells are best/trimmed avg. multipkg.*Many and cold.Warm*Many are batch metrics over the target count in each row.

Go 1.26.4 vs #2010 Scaling Snapshot

scenario targets metric Go 1.26.4 #2010
multipkg_6x6 36 FuncForPCMany 605/630ns 238/242.3ns
multipkg_6x6 36 FileLineMany 2/2.1us 312/319.3ns
multipkg_12x12 144 FuncForPCMany 2.5/2.5us 950/987ns
multipkg_12x12 144 FileLineMany 8/8.1us 1.3/1.3us
multipkg_24x24 576 FuncForPCMany 10.3/10.7us 3.9/3.9us
multipkg_24x24 576 FileLineMany 31.7/32.1us 5.1/5.1us
cold_6x6 36 FirstFuncForPC 2/2.2us 13.8/14ms
cold_12x12 144 FirstFuncForPC 2/2.3us 14.1/14.4ms
cold_24x24 576 FirstFuncForPC 2.5/3us 13.7/14.1ms
cold_24x24 576 WarmFuncForPCMany 10/10us 3.5/3.7us
cold_24x24 576 WarmFileLineMany 31.5/31.7us 4.9/4.9us

Interpretation

#2010 is faster than Go 1.26.4 on hot many-PC entry lookup in these generated probes, but still has a large cold first-use gap. The cold FirstFuncForPC results show lazy runtime funcinfo table initialization around 14 ms on macOS for this probe, while Go's linker-generated pclntab/findfunctab path stays in low microseconds.

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 51.36218% with 607 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
benchmark/runtime_funcinfo/main.go 0.00% 595 Missing ⚠️
cl/instr.go 97.51% 8 Missing and 4 partials ⚠️

📢 Thoughts on this report? Let us know!

@cpunion

cpunion commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded: the scaling harness was carried into #2016 as benchmark/runtime_funcinfo, now also covering ordinary-code (plain), call-depth and big-method scale dimensions.

@cpunion cpunion closed this Jul 2, 2026
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