Skip to content

perf(transform): prepare standard library function calls - #1032

Open
timggggggg wants to merge 12 commits into
masterfrom
1028-transform-prepare-function-calls
Open

timggggggg wants to merge 12 commits into
masterfrom
1028-transform-prepare-function-calls

Conversation

@timggggggg

@timggggggg timggggggg commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Prepare all standard library function calls at startup, precomputing argument layouts and defaults to reduce per-event lookups and allocations.

Preserve existing semantics and concurrency safety, with regression tests and benchmarks to validate correctness and performance.

Before #1028

Branch: 1033-expand-transform-benchmark-coverage. Commit: 4d1fcc3.

Scenario Variant ns/op B/op allocs/op
assign_new5 transform 445.4 312 9
assign_new5 modify 148.6 (-66.6%) 0 (-100.0%) 0 (-100.0%)
trim4 transform 1440 2352 33
trim4 modify 101.9 (-92.9%) 0 (-100.0%) 0 (-100.0%)
rename/preserve/5 transform 2212 1352 43
rename/preserve/5 rename 373.3 (-83.1%) 0 (-100.0%) 0 (-100.0%)
logs/no_regex/mixed transform 2782 3536 63
logs/no_regex/mixed modify 2922 (+5.0%) 687 (-80.6%) 0 (-100.0%)
logs/regex/mixed transform 16307 1864 35
logs/regex/mixed modify 92907 (+469.7%) 2250 (+20.7%) 12 (-65.7%)
chains/mapping/16/mixed transform 589.3 744 15
chains/mapping/16/mixed modify_x16 319.5 (-45.8%) 0 (-100.0%) 0 (-100.0%)
chains/tags/16/mixed transform 3820 3724 110
chains/tags/16/mixed modify_x16 478.7 (-87.5%) 0 (-100.0%) 0 (-100.0%)
dynamic/trim_slice/mixed transform 2756 5774 27
collections/filter_sum/64 transform 35502 50912 556

After #1028

Branch: 1028-transform-prepare-function-calls. Commit: 9fad910
(includes the merged benchmark branch).

Scenario Variant ns/op B/op allocs/op
assign_new5 transform 433.6 312 9
assign_new5 modify 147.5 (-66.0%) 0 (-100.0%) 0 (-100.0%)
trim4 transform 595.4 752 17
trim4 modify 102.7 (-82.8%) 0 (-100.0%) 0 (-100.0%)
rename/preserve/5 transform 2206 1352 43
rename/preserve/5 rename 372.4 (-83.1%) 0 (-100.0%) 0 (-100.0%)
logs/no_regex/mixed transform 1294 944 35
logs/no_regex/mixed modify 2814 (+117.5%) 686 (-27.3%) 0 (-100.0%)
logs/regex/mixed transform 15438 1480 31
logs/regex/mixed modify 86761 (+462.0%) 2234 (+50.9%) 12 (-61.3%)
chains/mapping/16/mixed transform 375.7 360 11
chains/mapping/16/mixed modify_x16 296.5 (-21.1%) 0 (-100.0%) 0 (-100.0%)
chains/tags/16/mixed transform 3543 3724 110
chains/tags/16/mixed modify_x16 481.9 (-86.4%) 0 (-100.0%) 0 (-100.0%)
dynamic/trim_slice/mixed transform 2135 4702 18
collections/filter_sum/64 transform 36641 50912 556

Conclusion

The percentages below compare transform after #1028 with transform before #1028,
using (after - before) / before * 100.

Preparing function calls in #1028 reduced allocation overhead in the function-call workloads. The largest
observed reductions in ns/op were in nested trim calls and regex-free log parsing:

  • trim4: -58.7% ns/op, -68.0% B/op, -48.5% allocs/op.
  • logs/no_regex/mixed: -53.5% ns/op, -73.3% B/op, -44.4% allocs/op.
  • chains/mapping/16/mixed: -36.2% ns/op, -51.6% B/op, -26.7% allocs/op.
  • dynamic/trim_slice/mixed: -22.5% ns/op, -18.6% B/op, -33.3% allocs/op.
  • logs/regex/mixed: -5.3% ns/op, -20.6% B/op, -11.4% allocs/op.

Fixes #1028

This branch has not been deployed

No deployments
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.

Feature: Prepare transform function calls across the standard library

1 participant