Skip to content

Use StringUtil.ToLowerInvariant()/StringUtil.ToUpperInvariant() on .NET Framework - #9180

Open
andrewlock wants to merge 5 commits into
masterfrom
andrew/use-new-tolowerinvariant
Open

Use StringUtil.ToLowerInvariant()/StringUtil.ToUpperInvariant() on .NET Framework#9180
andrewlock wants to merge 5 commits into
masterfrom
andrew/use-new-tolowerinvariant

Conversation

@andrewlock

@andrewlock andrewlock commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary of changes

Updates .NET Framework code to use StringUtil.ToLowerInvariant()/StringUtil.ToUpperInvariant() instead of string.ToLowerInvariant()/string.ToUpperInvariant()

Reason for change

On .NET Framework ToLowerInvariant() allocates, even if there's no change of case required. #9173 added a non-allocating version, but id dnot update call sites.

This PR updates all the callsites to use the new method, and adds a BannedSymbols analyzer to force you to use it.

Implementation details

  • Add a passthrough version to StringUtil for non-.NET Framework usage
    • Avoids needing to add #if NETFRAMEWORK everywhere, basically pass through
  • Updates StringUtil methods to accept nullable string, to make it easier to update x?.ToLowerInvariant() constructs
  • Add a banned symbols file that only applies to .NET Frameork
  • Update all flagged callsites to use the new API
  • Update the source generators that call it to use the new API

Note it would also be possible to make the StringUtil methods be extension methods, but then we'd need to rename them, e.g. StringUtil.ToLowerInvariantSafe() or something

Test coverage

Covered by existing tests

Other details

Stacked on

Compare this to the alternative approach:

Only one of those approaches will be merged!

@andrewlock andrewlock added the type:performance Performance, speed, latency, resource usage (CPU, memory) label Sep 4, 2026
@andrewlock

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-04T10:05:24.141814Z 3d7f80a Draft marked ready
🔒 Security Review Completed 2026-09-04T10:06:08.475698Z 3d7f80a Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 3d7f80a0a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 3d7f80a0a2

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@andrewlock
andrewlock marked this pull request as ready for review September 4, 2026 10:03
@andrewlock
andrewlock requested review from a team as code owners September 4, 2026 10:03
@andrewlock
andrewlock requested review from btthomas, kathiehuang, link04, sameerank and vandonr and removed request for a team September 4, 2026 10:03
@pr-commenter

pr-commenter Bot commented Sep 4, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-09-08 08:26:19

Comparing candidate commit a715a1a in PR branch andrew/use-new-tolowerinvariant with baseline commit 018da89 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 72 metrics, 0 unstable metrics, 74 known flaky benchmarks, 52 flaky benchmarks without significant changes.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Known flaky benchmarks

These benchmarks are marked as flaky and will not trigger a failure. Modify FLAKY_BENCHMARKS_REGEX to control which benchmarks are marked as flaky.

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net472

  • 🟩 throughput [+9345.003op/s; +10575.640op/s] or [+5.012%; +5.672%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net472

  • 🟩 throughput [+9203.983op/s; +10686.857op/s] or [+6.100%; +7.083%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net472

  • 🟩 throughput [+10903.575op/s; +11931.068op/s] or [+6.823%; +7.466%]

scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net472

  • 🟩 throughput [+8686.931op/s; +9596.800op/s] or [+5.208%; +5.754%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net472

  • 🟥 throughput [-6626.925op/s; -6163.304op/s] or [-7.858%; -7.308%]

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1

  • 🟥 throughput [-7841.113op/s; -6376.697op/s] or [-7.973%; -6.484%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 allocated_mem [+1.573KB; +1.573KB] or [+47.789%; +47.804%]
  • 🟥 execution_time [+308.137ms; +311.375ms] or [+152.908%; +154.515%]
  • 🟥 throughput [-57.309op/s; -52.768op/s] or [-10.311%; -9.494%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟥 allocated_mem [+1.013KB; +1.013KB] or [+37.563%; +37.575%]
  • unstable execution_time [+299.064ms; +360.323ms] or [+236.279%; +284.677%]
  • 🟩 throughput [+69.343op/s; +77.180op/s] or [+9.143%; +10.176%]

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 allocated_mem [+1.088KB; +1.088KB] or [+40.343%; +40.355%]
  • 🟥 execution_time [+393.909ms; +397.663ms] or [+348.595%; +351.917%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net472

  • 🟥 allocated_mem [+4.725KB; +4.726KB] or [+99.482%; +99.497%]
  • 🟥 throughput [-60496.988op/s; -60100.203op/s] or [-47.070%; -46.761%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net6.0

  • 🟥 allocated_mem [+3.848KB; +3.848KB] or [+81.379%; +81.391%]
  • 🟩 execution_time [-16.582ms; -12.400ms] or [-7.744%; -5.791%]
  • 🟥 throughput [-62049.279op/s; -59264.714op/s] or [-45.292%; -43.260%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody netcoreapp3.1

  • 🟥 allocated_mem [+4.576KB; +4.576KB] or [+98.954%; +98.966%]
  • 🟥 throughput [-49471.273op/s; -47228.700op/s] or [-44.728%; -42.700%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net472

  • 🟥 allocated_mem [+1.348KB; +1.348KB] or [+109.063%; +109.078%]
  • 🟥 throughput [-287600.561op/s; -283652.741op/s] or [-29.365%; -28.962%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody net6.0

  • 🟥 allocated_mem [+511 bytes; +512 bytes] or [+41.822%; +41.834%]
  • 🟩 execution_time [-27.276ms; -16.954ms] or [-12.164%; -7.561%]
  • 🟥 throughput [-110662.297op/s; -76446.303op/s] or [-11.822%; -8.167%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1

  • 🟥 allocated_mem [+1.312KB; +1.312KB] or [+108.600%; +108.616%]
  • 🟥 throughput [-172667.065op/s; -156051.218op/s] or [-24.809%; -22.422%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net472

  • 🟥 allocated_mem [+3.378KB; +3.378KB] or [+89.003%; +89.017%]
  • 🟥 throughput [-72334.320op/s; -71570.390op/s] or [-48.680%; -48.166%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody net6.0

  • 🟥 allocated_mem [+3.336KB; +3.336KB] or [+88.150%; +88.161%]
  • 🟥 throughput [-75019.920op/s; -72143.450op/s] or [-47.734%; -45.904%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody netcoreapp3.1

  • 🟥 allocated_mem [+3.264KB; +3.264KB] or [+88.493%; +88.506%]
  • 🟥 throughput [-55507.352op/s; -52889.280op/s] or [-44.219%; -42.133%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net6.0

  • 🟩 throughput [+188708.375op/s; +238671.213op/s] or [+6.292%; +7.958%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody netcoreapp3.1

  • 🟩 execution_time [-19.288ms; -14.953ms] or [-8.891%; -6.893%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net472

  • 🟩 allocated_mem [-13.759KB; -13.756KB] or [-42.324%; -42.316%]
  • 🟥 execution_time [+300.102ms; +300.770ms] or [+149.951%; +150.284%]
  • 🟩 throughput [+1032.154op/s; +1048.235op/s] or [+11.400%; +11.578%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs net6.0

  • 🟩 allocated_mem [-13.722KB; -13.718KB] or [-42.341%; -42.329%]
  • 🟥 execution_time [+300.427ms; +303.631ms] or [+151.506%; +153.122%]
  • 🟩 throughput [+2129.601op/s; +2371.249op/s] or [+16.288%; +18.137%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeArgs netcoreapp3.1

  • 🟩 allocated_mem [-13.722KB; -13.718KB] or [-42.341%; -42.329%]
  • 🟥 execution_time [+300.985ms; +303.394ms] or [+151.613%; +152.826%]
  • 🟩 throughput [+1829.106op/s; +1957.982op/s] or [+17.659%; +18.903%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net472

  • 🟥 execution_time [+296.009ms; +297.140ms] or [+145.388%; +145.944%]
  • 🟩 throughput [+599.659op/s; +608.346op/s] or [+15.897%; +16.127%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net6.0

  • 🟥 execution_time [+297.346ms; +299.598ms] or [+145.361%; +146.462%]
  • 🟩 throughput [+2732.636op/s; +2800.962op/s] or [+39.700%; +40.693%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1

  • 🟥 execution_time [+300.080ms; +301.553ms] or [+149.979%; +150.716%]
  • 🟩 throughput [+1457.094op/s; +1473.977op/s] or [+28.922%; +29.257%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net472

  • 🟩 execution_time [-144.114µs; -139.590µs] or [-29.589%; -28.660%]
  • 🟩 throughput [+828.886op/s; +860.222op/s] or [+40.370%; +41.897%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark net6.0

  • 🟩 execution_time [-128.873µs; -102.050µs] or [-29.557%; -23.405%]
  • 🟩 throughput [+758.322op/s; +883.657op/s] or [+32.969%; +38.418%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmark netcoreapp3.1

  • 🟩 execution_time [-141.707µs; -119.649µs] or [-30.361%; -25.635%]
  • 🟩 throughput [+768.021op/s; +852.052op/s] or [+35.453%; +39.332%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net472

  • 🟩 execution_time [-126.014µs; -121.550µs] or [-34.023%; -32.818%]
  • 🟩 throughput [+1329.983op/s; +1383.871op/s] or [+49.256%; +51.252%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack net6.0

  • 🟩 execution_time [-98.669µs; -73.489µs] or [-31.500%; -23.461%]
  • 🟩 throughput [+1093.189op/s; +1326.610op/s] or [+34.078%; +41.354%]

scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack netcoreapp3.1

  • 🟩 execution_time [-135.434µs; -113.014µs] or [-37.049%; -30.916%]
  • 🟩 throughput [+1289.244op/s; +1427.347op/s] or [+46.266%; +51.222%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net472

  • 🟥 execution_time [+299.329ms; +300.049ms] or [+149.396%; +149.755%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net6.0

  • unstable execution_time [+411.290ms; +422.185ms] or [+446.884%; +458.721%]
  • 🟩 throughput [+741.897op/s; +911.697op/s] or [+6.096%; +7.492%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest netcoreapp3.1

  • 🟥 execution_time [+368.482ms; +372.775ms] or [+279.785%; +283.044%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • unstable execution_time [+322.305ms; +373.594ms] or [+148.193%; +171.775%]
  • 🟥 throughput [-550.196op/s; -503.502op/s] or [-49.853%; -45.622%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • unstable execution_time [+207.467ms; +340.723ms] or [+88.414%; +145.202%]
  • 🟥 throughput [-679.327op/s; -595.619op/s] or [-45.311%; -39.728%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟥 execution_time [+340.696ms; +354.739ms] or [+203.776%; +212.175%]
  • 🟥 throughput [-421.621op/s; -385.476op/s] or [-29.357%; -26.840%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1

  • unstable throughput [+19.342op/s; +66.314op/s] or [+5.560%; +19.062%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool netcoreapp3.1

  • unstable throughput [-18.024op/s; +59.903op/s] or [-3.364%; +11.181%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net6.0

  • 🟩 execution_time [-185.047µs; -153.715µs] or [-9.374%; -7.787%]
  • 🟩 throughput [+43.735op/s; +52.288op/s] or [+8.634%; +10.322%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net472

  • 🟥 execution_time [+300.896ms; +302.352ms] or [+151.526%; +152.259%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch net6.0

  • 🟥 execution_time [+302.667ms; +305.834ms] or [+151.667%; +153.254%]
  • 🟩 throughput [+33068.630op/s; +38915.299op/s] or [+5.214%; +6.135%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch netcoreapp3.1

  • 🟥 execution_time [+300.637ms; +304.451ms] or [+151.027%; +152.944%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net472

  • 🟥 execution_time [+301.146ms; +302.672ms] or [+151.225%; +151.992%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync net6.0

  • 🟥 execution_time [+300.681ms; +303.696ms] or [+148.674%; +150.164%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync netcoreapp3.1

  • 🟥 execution_time [+304.185ms; +308.521ms] or [+154.175%; +156.372%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 execution_time [+301.682ms; +303.802ms] or [+151.417%; +152.481%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net6.0

  • 🟥 execution_time [+302.050ms; +304.758ms] or [+150.544%; +151.894%]
  • 🟩 throughput [+51138.160op/s; +55727.759op/s] or [+10.154%; +11.066%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync netcoreapp3.1

  • 🟥 execution_time [+301.443ms; +304.036ms] or [+149.965%; +151.255%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net6.0

  • 🟩 execution_time [-16.366ms; -12.697ms] or [-7.610%; -5.904%]
  • 🟩 throughput [+18356.250op/s; +25454.883op/s] or [+5.036%; +6.983%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net472

  • unstable execution_time [+3.255µs; +46.648µs] or [+0.804%; +11.522%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net6.0

  • 🟩 allocated_mem [-19.313KB; -19.289KB] or [-7.045%; -7.036%]
  • unstable execution_time [-17.232µs; +41.915µs] or [-3.406%; +8.284%]
  • unstable throughput [-149.747op/s; +54.840op/s] or [-7.472%; +2.737%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1

  • unstable execution_time [-56.095µs; +6.030µs] or [-9.721%; +1.045%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net472

  • 🟥 allocated_mem [+8.190KB; +8.196KB] or [+16.663%; +16.675%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark net6.0

  • unstable execution_time [+7.810µs; +12.101µs] or [+18.460%; +28.603%]
  • 🟥 throughput [-5401.692op/s; -3569.888op/s] or [-22.739%; -15.028%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark netcoreapp3.1

  • unstable execution_time [-13.750µs; -5.416µs] or [-21.333%; -8.402%]
  • unstable throughput [+1407.222op/s; +3254.962op/s] or [+8.634%; +19.970%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net472

  • 🟥 execution_time [+303.565ms; +304.945ms] or [+153.438%; +154.136%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+302.311ms; +304.580ms] or [+153.876%; +155.030%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+300.930ms; +303.103ms] or [+150.653%; +151.740%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net6.0

  • 🟩 throughput [+30728.559op/s; +35669.621op/s] or [+5.816%; +6.752%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net472

  • 🟥 execution_time [+298.497ms; +300.687ms] or [+148.774%; +149.865%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog net6.0

  • 🟥 execution_time [+303.145ms; +304.855ms] or [+152.225%; +153.084%]

scenario:Benchmarks.Trace.SerilogBenchmark.EnrichedLog netcoreapp3.1

  • 🟥 execution_time [+304.180ms; +306.550ms] or [+154.261%; +155.462%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net472

  • 🟥 execution_time [+299.993ms; +301.022ms] or [+149.638%; +150.151%]
  • 🟩 throughput [+61192761.166op/s; +61544974.946op/s] or [+44.564%; +44.821%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net6.0

  • unstable execution_time [+329.208ms; +395.064ms] or [+409.428%; +491.332%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore netcoreapp3.1

  • 🟥 execution_time [+299.004ms; +300.050ms] or [+149.137%; +149.658%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net6.0

  • 🟩 throughput [+80860.636op/s; +88229.028op/s] or [+7.550%; +8.238%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope netcoreapp3.1

  • 🟩 throughput [+49461.854op/s; +68523.457op/s] or [+5.725%; +7.931%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0

  • 🟩 throughput [+74154.422op/s; +104266.393op/s] or [+5.740%; +8.070%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan netcoreapp3.1

  • 🟩 throughput [+70833.366op/s; +79770.152op/s] or [+7.035%; +7.922%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net6.0

  • 🟩 throughput [+49499.510op/s; +54010.952op/s] or [+8.988%; +9.807%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net472

  • 🟥 throughput [-41307.738op/s; -35365.611op/s] or [-6.046%; -5.176%]

scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin net6.0

  • 🟩 throughput [+70627.540op/s; +88462.958op/s] or [+7.891%; +9.884%]

Known flaky benchmarks without significant changes:

  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.ActivityBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_AddEvent_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_GetContext_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_RecordException_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetAttributes_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_SetStatus_Sampled netcoreapp3.1
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net472
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled net6.0
  • scenario:Benchmarks.OpenTelemetry.InstrumentedApi.Trace.TelemetrySpanBenchmark.StartSpan_UpdateName_Sampled netcoreapp3.1
  • scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild net6.0
  • scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net472
  • scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice netcoreapp3.1
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog net472
  • scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive net472
  • scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes net472
  • scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1
  • scenario:Benchmarks.Trace.TraceAnnotationsBenchmark.RunOnMethodBegin netcoreapp3.1

Base automatically changed from andrew/tolowerinvariant-optimizations to master September 7, 2026 17:39
…net461

Adds a net461-only banned-symbols file to force using StringUtil on .NET Framework.
 The two IAST aspects intentionally keep calling the BCL directly
…ringUtil

Switches every shared Datadog.Trace call site from the allocating BCL
methods to StringUtil.ToUpperInvariant/ToLowerInvariant, so the
non-allocating .NET Framework fast path added in previous commits
actually gets used. Prepares for banning the raw BCL methods on net461.
…ringUtil on .NET Framework

The EnumExtensions generator's fallback methods called string.ToUpperInvariant()
directly in the generated code, which will trip the upcoming net461 ban on that
BCL method. Emit a single private helper with an #if NETFRAMEWORK branch to
StringUtil.ToUpperInvariant instead, and regenerate the four checked-in outputs.
@andrewlock
andrewlock force-pushed the andrew/use-new-tolowerinvariant branch from 3d7f80a to a715a1a Compare September 8, 2026 07:37
@dd-trace-dotnet-ci-bot

Copy link
Copy Markdown

Execution-Time Benchmarks Report ⏱️

Execution-time results for samples comparing This PR (9180) and master.

✅ No regressions detected

📄 View the full report (charts + all metrics) →

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:performance Performance, speed, latency, resource usage (CPU, memory)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant