Skip to content

Conversation

@morrisonlevi
Copy link
Contributor

What does this PR do?

This adds two new methods to libdd_profiling::internal::Profile with supporting types:

  • Profile::try_new2
  • Profile::try_add_sample2

Motivation

These APIs together are faster than the versions that aren't suffixed with 2.

Additional Notes

This doesn't add the FFI API yet, that's coming next.

How to test the change?

Everything should be the same. There is a benchmark you can run to compare some basic API level tests. Here is what I got locally on my M1:

profile_add_sample_frames_x1000
                        time:   [679.01 µs 681.72 µs 685.57 µs]
Found 4 outliers among 100 measurements (4.00%)
  2 (2.00%) high mild
  2 (2.00%) high severe

profile_add_sample2_frames_x1000
                        time:   [231.41 µs 235.60 µs 240.77 µs]
Found 10 outliers among 100 measurements (10.00%)
  3 (3.00%) high mild
  7 (7.00%) high severe

In this basic benchmarking test, it's roughly 3x faster.

@morrisonlevi morrisonlevi added the profiling Relates to the profiling* modules. label Nov 17, 2025
@github-actions github-actions bot removed the profiling Relates to the profiling* modules. label Nov 17, 2025
@pr-commenter
Copy link

pr-commenter bot commented Nov 17, 2025

Benchmarks

Comparison

Benchmark execution time: 2025-11-20 04:42:30

Comparing candidate commit 38c8e3c in PR branch levi/try_add_sample2 with baseline commit 89b7a8e in branch levi/profiles_dictionary.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 55 metrics, 2 unstable metrics.

Candidate

Candidate benchmark details

Group 1

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
receiver_entry_point/report/2597 execution_time 6.080ms 6.387ms ± 0.079ms 6.407ms ± 0.024ms 6.430ms 6.456ms 6.480ms 6.632ms 3.50% -1.744 3.747 1.23% 0.006ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
receiver_entry_point/report/2597 execution_time [6.376ms; 6.398ms] or [-0.171%; +0.171%] None None None

Group 2

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
benching deserializing traces from msgpack to their internal representation execution_time 63.631ms 64.176ms ± 2.149ms 63.890ms ± 0.120ms 64.047ms 64.218ms 72.664ms 85.358ms 33.60% 8.849 79.620 3.34% 0.152ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
benching deserializing traces from msgpack to their internal representation execution_time [63.878ms; 64.474ms] or [-0.464%; +0.464%] None None None

Group 3

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... execution_time 204.975µs 205.543µs ± 0.309µs 205.513µs ± 0.208µs 205.743µs 206.027µs 206.273µs 207.286µs 0.86% 1.082 4.137 0.15% 0.022µs 1 200
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... throughput 4824248.079op/s 4865181.906op/s ± 7294.461op/s 4865881.191op/s ± 4926.371op/s 4870477.067op/s 4876082.919op/s 4877214.947op/s 4878653.386op/s 0.26% -1.060 4.005 0.15% 515.796op/s 1 200
normalization/normalize_name/normalize_name/bad-name execution_time 18.164µs 18.305µs ± 0.112µs 18.274µs ± 0.053µs 18.338µs 18.528µs 18.636µs 18.846µs 3.13% 1.560 3.167 0.61% 0.008µs 1 200
normalization/normalize_name/normalize_name/bad-name throughput 53062556.741op/s 54632118.855op/s ± 330650.413op/s 54721185.222op/s ± 158798.254op/s 54862297.938op/s 55024523.947op/s 55051163.025op/s 55053519.886op/s 0.61% -1.511 2.910 0.60% 23380.515op/s 1 200
normalization/normalize_name/normalize_name/good execution_time 10.575µs 10.783µs ± 0.114µs 10.774µs ± 0.072µs 10.848µs 10.954µs 10.991µs 11.626µs 7.90% 2.029 13.466 1.05% 0.008µs 1 200
normalization/normalize_name/normalize_name/good throughput 86015970.080op/s 92749804.235op/s ± 959684.180op/s 92811895.996op/s ± 625549.959op/s 93430432.178op/s 94100167.330op/s 94519274.662op/s 94564354.291op/s 1.89% -1.701 10.581 1.03% 67859.919op/s 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... execution_time [205.500µs; 205.585µs] or [-0.021%; +0.021%] None None None
normalization/normalize_name/normalize_name/Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Long-.Too-Lo... throughput [4864170.964op/s; 4866192.848op/s] or [-0.021%; +0.021%] None None None
normalization/normalize_name/normalize_name/bad-name execution_time [18.289µs; 18.320µs] or [-0.085%; +0.085%] None None None
normalization/normalize_name/normalize_name/bad-name throughput [54586293.888op/s; 54677943.823op/s] or [-0.084%; +0.084%] None None None
normalization/normalize_name/normalize_name/good execution_time [10.767µs; 10.799µs] or [-0.146%; +0.146%] None None None
normalization/normalize_name/normalize_name/good throughput [92616801.238op/s; 92882807.233op/s] or [-0.143%; +0.143%] None None None

Group 4

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... execution_time 533.777µs 534.643µs ± 1.062µs 534.473µs ± 0.269µs 534.798µs 535.414µs 538.968µs 546.560µs 2.26% 8.145 82.132 0.20% 0.075µs 1 200
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... throughput 1829624.702op/s 1870415.030op/s ± 3655.716op/s 1871003.447op/s ± 942.500op/s 1871775.557op/s 1872751.246op/s 1873160.345op/s 1873440.705op/s 0.13% -8.040 80.378 0.19% 258.498op/s 1 200
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて execution_time 380.411µs 381.370µs ± 0.414µs 381.343µs ± 0.272µs 381.626µs 382.091µs 382.437µs 382.599µs 0.33% 0.336 -0.039 0.11% 0.029µs 1 200
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて throughput 2613702.003op/s 2622131.750op/s ± 2846.105op/s 2622312.045op/s ± 1867.295op/s 2624053.259op/s 2626450.083op/s 2627885.632op/s 2628733.659op/s 0.24% -0.330 -0.044 0.11% 201.250op/s 1 200
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters execution_time 195.359µs 196.190µs ± 0.236µs 196.201µs ± 0.120µs 196.329µs 196.534µs 196.686µs 196.695µs 0.25% -0.783 1.484 0.12% 0.017µs 1 200
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters throughput 5084001.077op/s 5097097.682op/s ± 6130.303op/s 5096824.578op/s ± 3113.882op/s 5099818.376op/s 5108634.237op/s 5116462.213op/s 5118790.974op/s 0.43% 0.793 1.506 0.12% 433.478op/s 1 200
normalization/normalize_service/normalize_service/[empty string] execution_time 37.022µs 37.245µs ± 0.092µs 37.248µs ± 0.061µs 37.307µs 37.397µs 37.453µs 37.469µs 0.59% 0.018 -0.322 0.25% 0.006µs 1 200
normalization/normalize_service/normalize_service/[empty string] throughput 26688882.575op/s 26849372.767op/s ± 66248.745op/s 26846923.990op/s ± 44088.513op/s 26894717.190op/s 26958714.821op/s 26989006.954op/s 27010669.529op/s 0.61% -0.006 -0.324 0.25% 4684.494op/s 1 200
normalization/normalize_service/normalize_service/test_ASCII execution_time 44.902µs 45.087µs ± 0.188µs 45.066µs ± 0.156µs 45.212µs 45.359µs 45.490µs 46.448µs 3.07% 2.121 11.861 0.42% 0.013µs 1 200
normalization/normalize_service/normalize_service/test_ASCII throughput 21529390.489op/s 22179632.836op/s ± 91815.972op/s 22189907.221op/s ± 76870.549op/s 22266769.506op/s 22269948.922op/s 22270329.984op/s 22270772.506op/s 0.36% -2.009 10.793 0.41% 6492.370op/s 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... execution_time [534.496µs; 534.790µs] or [-0.028%; +0.028%] None None None
normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000... throughput [1869908.383op/s; 1870921.677op/s] or [-0.027%; +0.027%] None None None
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて execution_time [381.312µs; 381.427µs] or [-0.015%; +0.015%] None None None
normalization/normalize_service/normalize_service/Data🐨dog🐶 繋がっ⛰てて throughput [2621737.308op/s; 2622526.193op/s] or [-0.015%; +0.015%] None None None
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters execution_time [196.158µs; 196.223µs] or [-0.017%; +0.017%] None None None
normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters throughput [5096248.081op/s; 5097947.283op/s] or [-0.017%; +0.017%] None None None
normalization/normalize_service/normalize_service/[empty string] execution_time [37.232µs; 37.258µs] or [-0.034%; +0.034%] None None None
normalization/normalize_service/normalize_service/[empty string] throughput [26840191.328op/s; 26858554.206op/s] or [-0.034%; +0.034%] None None None
normalization/normalize_service/normalize_service/test_ASCII execution_time [45.061µs; 45.113µs] or [-0.058%; +0.058%] None None None
normalization/normalize_service/normalize_service/test_ASCII throughput [22166908.026op/s; 22192357.647op/s] or [-0.057%; +0.057%] None None None

Group 5

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
normalization/normalize_trace/test_trace execution_time 243.138ns 251.985ns ± 11.841ns 247.444ns ± 3.153ns 252.927ns 285.444ns 287.197ns 287.546ns 16.21% 2.097 3.207 4.69% 0.837ns 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
normalization/normalize_trace/test_trace execution_time [250.344ns; 253.626ns] or [-0.651%; +0.651%] None None None

Group 6

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
sql/obfuscate_sql_string execution_time 86.367µs 86.678µs ± 0.251µs 86.658µs ± 0.042µs 86.702µs 86.768µs 87.021µs 90.033µs 3.89% 12.103 159.590 0.29% 0.018µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
sql/obfuscate_sql_string execution_time [86.643µs; 86.712µs] or [-0.040%; +0.040%] None None None

Group 7

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
two way interface execution_time 17.689µs 25.304µs ± 9.031µs 18.222µs ± 0.400µs 32.726µs 41.518µs 50.969µs 63.663µs 249.38% 1.033 0.974 35.60% 0.639µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
two way interface execution_time [24.052µs; 26.555µs] or [-4.946%; +4.946%] None None None

Group 8

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
redis/obfuscate_redis_string execution_time 33.659µs 34.160µs ± 0.843µs 33.774µs ± 0.069µs 33.899µs 35.943µs 35.973µs 37.389µs 10.70% 1.758 1.411 2.46% 0.060µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
redis/obfuscate_redis_string execution_time [34.043µs; 34.277µs] or [-0.342%; +0.342%] None None None

Group 9

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
profile_add_sample2_frames_x1000 execution_time 516.846µs 517.731µs ± 0.404µs 517.648µs ± 0.257µs 517.964µs 518.516µs 518.778µs 518.902µs 0.24% 0.691 0.077 0.08% 0.029µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
profile_add_sample2_frames_x1000 execution_time [517.675µs; 517.787µs] or [-0.011%; +0.011%] None None None

Group 10

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
ip_address/quantize_peer_ip_address_benchmark execution_time 5.003µs 5.076µs ± 0.045µs 5.063µs ± 0.027µs 5.092µs 5.155µs 5.160µs 5.161µs 1.92% 0.478 -0.889 0.89% 0.003µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
ip_address/quantize_peer_ip_address_benchmark execution_time [5.070µs; 5.083µs] or [-0.123%; +0.123%] None None None

Group 11

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
credit_card/is_card_number/ execution_time 3.896µs 3.915µs ± 0.003µs 3.915µs ± 0.002µs 3.917µs 3.919µs 3.921µs 3.923µs 0.20% -1.464 9.432 0.07% 0.000µs 1 200
credit_card/is_card_number/ throughput 254894162.534op/s 255406521.653op/s ± 188068.745op/s 255405082.561op/s ± 113235.196op/s 255504942.392op/s 255681061.398op/s 255766778.289op/s 256686332.217op/s 0.50% 1.484 9.586 0.07% 13298.468op/s 1 200
credit_card/is_card_number/ 3782-8224-6310-005 execution_time 77.859µs 78.485µs ± 0.732µs 78.202µs ± 0.273µs 78.779µs 80.258µs 80.902µs 81.065µs 3.66% 1.646 2.193 0.93% 0.052µs 1 200
credit_card/is_card_number/ 3782-8224-6310-005 throughput 12335782.307op/s 12742349.203op/s ± 117133.749op/s 12787438.902op/s ± 44652.459op/s 12827757.343op/s 12835529.388op/s 12839827.735op/s 12843725.178op/s 0.44% -1.605 2.028 0.92% 8282.607op/s 1 200
credit_card/is_card_number/ 378282246310005 execution_time 71.451µs 71.678µs ± 0.324µs 71.571µs ± 0.058µs 71.667µs 72.457µs 73.108µs 73.579µs 2.81% 3.256 11.443 0.45% 0.023µs 1 200
credit_card/is_card_number/ 378282246310005 throughput 13590844.896op/s 13951629.360op/s ± 62075.788op/s 13972198.818op/s ± 11260.846op/s 13981587.647op/s 13989485.852op/s 13992728.879op/s 13995559.209op/s 0.17% -3.218 11.133 0.44% 4389.421op/s 1 200
credit_card/is_card_number/37828224631 execution_time 3.894µs 3.915µs ± 0.003µs 3.914µs ± 0.001µs 3.916µs 3.918µs 3.920µs 3.922µs 0.19% -2.114 18.172 0.06% 0.000µs 1 200
credit_card/is_card_number/37828224631 throughput 254974497.561op/s 255457440.879op/s ± 166338.289op/s 255465486.624op/s ± 80384.008op/s 255542867.321op/s 255666333.960op/s 255724172.709op/s 256773545.431op/s 0.51% 2.145 18.448 0.06% 11761.893op/s 1 200
credit_card/is_card_number/378282246310005 execution_time 68.224µs 68.626µs ± 0.644µs 68.319µs ± 0.047µs 68.568µs 70.102µs 71.045µs 71.186µs 4.20% 2.083 3.646 0.94% 0.046µs 1 200
credit_card/is_card_number/378282246310005 throughput 14047632.176op/s 14572965.839op/s ± 134089.028op/s 14637134.969op/s ± 10148.250op/s 14645033.528op/s 14651066.683op/s 14654966.753op/s 14657614.576op/s 0.14% -2.047 3.440 0.92% 9481.526op/s 1 200
credit_card/is_card_number/37828224631000521389798 execution_time 45.468µs 45.731µs ± 0.096µs 45.738µs ± 0.064µs 45.802µs 45.873µs 45.917µs 45.985µs 0.54% -0.290 0.042 0.21% 0.007µs 1 200
credit_card/is_card_number/37828224631000521389798 throughput 21746152.495op/s 21867029.075op/s ± 46030.215op/s 21863709.522op/s ± 30790.902op/s 21893494.944op/s 21949094.982op/s 21977577.671op/s 21993688.715op/s 0.59% 0.302 0.050 0.21% 3254.828op/s 1 200
credit_card/is_card_number/x371413321323331 execution_time 6.553µs 6.620µs ± 0.017µs 6.621µs ± 0.013µs 6.634µs 6.640µs 6.644µs 6.649µs 0.43% -0.714 0.487 0.25% 0.001µs 1 200
credit_card/is_card_number/x371413321323331 throughput 150398630.876op/s 151068677.879op/s ± 378266.189op/s 151040719.598op/s ± 292367.204op/s 151275749.781op/s 151820704.316op/s 151939369.750op/s 152611306.462op/s 1.04% 0.729 0.535 0.25% 26747.459op/s 1 200
credit_card/is_card_number_no_luhn/ execution_time 3.894µs 3.915µs ± 0.003µs 3.914µs ± 0.001µs 3.916µs 3.921µs 3.925µs 3.930µs 0.41% 0.114 10.734 0.08% 0.000µs 1 200
credit_card/is_card_number_no_luhn/ throughput 254428195.782op/s 255439970.779op/s ± 212569.240op/s 255476355.664op/s ± 89338.880op/s 255547947.185op/s 255654219.573op/s 255695738.165op/s 256803199.195op/s 0.52% -0.082 10.855 0.08% 15030.915op/s 1 200
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 execution_time 65.152µs 65.727µs ± 0.079µs 65.722µs ± 0.037µs 65.763µs 65.823µs 65.887µs 66.191µs 0.71% -0.259 20.344 0.12% 0.006µs 1 200
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 throughput 15107880.636op/s 15214490.624op/s ± 18395.239op/s 15215556.704op/s ± 8470.832op/s 15223026.290op/s 15236511.894op/s 15242428.464op/s 15348730.685op/s 0.88% 0.340 20.569 0.12% 1300.740op/s 1 200
credit_card/is_card_number_no_luhn/ 378282246310005 execution_time 53.352µs 53.423µs ± 0.053µs 53.415µs ± 0.018µs 53.436µs 53.481µs 53.512µs 53.894µs 0.90% 5.597 44.039 0.10% 0.004µs 1 200
credit_card/is_card_number_no_luhn/ 378282246310005 throughput 18554986.964op/s 18718570.474op/s ± 18325.012op/s 18721258.387op/s ± 6167.033op/s 18726884.624op/s 18735411.822op/s 18740054.450op/s 18743404.291op/s 0.12% -5.553 43.544 0.10% 1295.774op/s 1 200
credit_card/is_card_number_no_luhn/37828224631 execution_time 3.894µs 3.915µs ± 0.003µs 3.914µs ± 0.001µs 3.916µs 3.918µs 3.922µs 3.927µs 0.31% -1.128 15.243 0.07% 0.000µs 1 200
credit_card/is_card_number_no_luhn/37828224631 throughput 254676325.827op/s 255448720.390op/s ± 183073.137op/s 255464848.039op/s ± 89706.779op/s 255540822.646op/s 255679845.203op/s 255748505.723op/s 256793675.177op/s 0.52% 1.162 15.452 0.07% 12945.226op/s 1 200
credit_card/is_card_number_no_luhn/378282246310005 execution_time 50.145µs 50.210µs ± 0.032µs 50.204µs ± 0.020µs 50.229µs 50.270µs 50.308µs 50.319µs 0.23% 0.813 0.745 0.06% 0.002µs 1 200
credit_card/is_card_number_no_luhn/378282246310005 throughput 19873386.654op/s 19916382.068op/s ± 12748.998op/s 19918786.129op/s ± 7973.627op/s 19925403.275op/s 19933713.925op/s 19938140.166op/s 19942281.056op/s 0.12% -0.809 0.736 0.06% 901.490op/s 1 200
credit_card/is_card_number_no_luhn/37828224631000521389798 execution_time 45.458µs 45.681µs ± 0.081µs 45.682µs ± 0.052µs 45.728µs 45.821µs 45.865µs 45.896µs 0.47% 0.046 0.058 0.18% 0.006µs 1 200
credit_card/is_card_number_no_luhn/37828224631000521389798 throughput 21788627.431op/s 21891030.812op/s ± 38725.421op/s 21890655.979op/s ± 25091.582op/s 21915929.594op/s 21953855.442op/s 21981564.864op/s 21998542.471op/s 0.49% -0.035 0.060 0.18% 2738.301op/s 1 200
credit_card/is_card_number_no_luhn/x371413321323331 execution_time 6.564µs 6.617µs ± 0.018µs 6.619µs ± 0.013µs 6.633µs 6.637µs 6.641µs 6.646µs 0.41% -0.842 0.031 0.27% 0.001µs 1 200
credit_card/is_card_number_no_luhn/x371413321323331 throughput 150467404.302op/s 151131297.140op/s ± 412532.943op/s 151081069.045op/s ± 304705.364op/s 151308768.339op/s 151990014.613op/s 152161593.477op/s 152352485.613op/s 0.84% 0.853 0.055 0.27% 29170.484op/s 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
credit_card/is_card_number/ execution_time [3.915µs; 3.916µs] or [-0.010%; +0.010%] None None None
credit_card/is_card_number/ throughput [255380457.134op/s; 255432586.172op/s] or [-0.010%; +0.010%] None None None
credit_card/is_card_number/ 3782-8224-6310-005 execution_time [78.384µs; 78.587µs] or [-0.129%; +0.129%] None None None
credit_card/is_card_number/ 3782-8224-6310-005 throughput [12726115.592op/s; 12758582.814op/s] or [-0.127%; +0.127%] None None None
credit_card/is_card_number/ 378282246310005 execution_time [71.633µs; 71.722µs] or [-0.063%; +0.063%] None None None
credit_card/is_card_number/ 378282246310005 throughput [13943026.253op/s; 13960232.467op/s] or [-0.062%; +0.062%] None None None
credit_card/is_card_number/37828224631 execution_time [3.914µs; 3.915µs] or [-0.009%; +0.009%] None None None
credit_card/is_card_number/37828224631 throughput [255434387.992op/s; 255480493.766op/s] or [-0.009%; +0.009%] None None None
credit_card/is_card_number/378282246310005 execution_time [68.537µs; 68.715µs] or [-0.130%; +0.130%] None None None
credit_card/is_card_number/378282246310005 throughput [14554382.390op/s; 14591549.289op/s] or [-0.128%; +0.128%] None None None
credit_card/is_card_number/37828224631000521389798 execution_time [45.718µs; 45.744µs] or [-0.029%; +0.029%] None None None
credit_card/is_card_number/37828224631000521389798 throughput [21860649.730op/s; 21873408.420op/s] or [-0.029%; +0.029%] None None None
credit_card/is_card_number/x371413321323331 execution_time [6.617µs; 6.622µs] or [-0.035%; +0.035%] None None None
credit_card/is_card_number/x371413321323331 throughput [151016253.823op/s; 151121101.935op/s] or [-0.035%; +0.035%] None None None
credit_card/is_card_number_no_luhn/ execution_time [3.914µs; 3.915µs] or [-0.012%; +0.012%] None None None
credit_card/is_card_number_no_luhn/ throughput [255410510.727op/s; 255469430.831op/s] or [-0.012%; +0.012%] None None None
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 execution_time [65.716µs; 65.738µs] or [-0.017%; +0.017%] None None None
credit_card/is_card_number_no_luhn/ 3782-8224-6310-005 throughput [15211941.221op/s; 15217040.027op/s] or [-0.017%; +0.017%] None None None
credit_card/is_card_number_no_luhn/ 378282246310005 execution_time [53.416µs; 53.430µs] or [-0.014%; +0.014%] None None None
credit_card/is_card_number_no_luhn/ 378282246310005 throughput [18716030.804op/s; 18721110.145op/s] or [-0.014%; +0.014%] None None None
credit_card/is_card_number_no_luhn/37828224631 execution_time [3.914µs; 3.915µs] or [-0.010%; +0.010%] None None None
credit_card/is_card_number_no_luhn/37828224631 throughput [255423348.214op/s; 255474092.566op/s] or [-0.010%; +0.010%] None None None
credit_card/is_card_number_no_luhn/378282246310005 execution_time [50.205µs; 50.214µs] or [-0.009%; +0.009%] None None None
credit_card/is_card_number_no_luhn/378282246310005 throughput [19914615.180op/s; 19918148.957op/s] or [-0.009%; +0.009%] None None None
credit_card/is_card_number_no_luhn/37828224631000521389798 execution_time [45.670µs; 45.692µs] or [-0.025%; +0.025%] None None None
credit_card/is_card_number_no_luhn/37828224631000521389798 throughput [21885663.841op/s; 21896397.783op/s] or [-0.025%; +0.025%] None None None
credit_card/is_card_number_no_luhn/x371413321323331 execution_time [6.614µs; 6.619µs] or [-0.038%; +0.038%] None None None
credit_card/is_card_number_no_luhn/x371413321323331 throughput [151074124.042op/s; 151188470.239op/s] or [-0.038%; +0.038%] None None None

Group 12

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
single_flag_killswitch/rules-based execution_time 189.718ns 192.702ns ± 2.192ns 192.502ns ± 1.212ns 193.446ns 196.245ns 199.612ns 204.286ns 6.12% 1.547 4.562 1.13% 0.155ns 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
single_flag_killswitch/rules-based execution_time [192.398ns; 193.006ns] or [-0.158%; +0.158%] None None None

Group 13

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
sdk_test_data/rules-based execution_time 144.350µs 146.665µs ± 1.980µs 146.353µs ± 0.644µs 147.027µs 148.886µs 153.805µs 166.069µs 13.47% 6.133 51.142 1.35% 0.140µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
sdk_test_data/rules-based execution_time [146.391µs; 146.940µs] or [-0.187%; +0.187%] None None None

Group 14

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
tags/replace_trace_tags execution_time 2.398µs 2.431µs ± 0.013µs 2.430µs ± 0.012µs 2.443µs 2.450µs 2.452µs 2.456µs 1.08% -0.043 -1.105 0.54% 0.001µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
tags/replace_trace_tags execution_time [2.429µs; 2.433µs] or [-0.074%; +0.074%] None None None

Group 15

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
concentrator/add_spans_to_concentrator execution_time 10.607ms 10.639ms ± 0.014ms 10.637ms ± 0.010ms 10.648ms 10.661ms 10.673ms 10.704ms 0.63% 0.687 1.563 0.14% 0.001ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
concentrator/add_spans_to_concentrator execution_time [10.637ms; 10.641ms] or [-0.019%; +0.019%] None None None

Group 16

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
profile_add_sample_frames_x1000 execution_time 3.685ms 3.689ms ± 0.007ms 3.688ms ± 0.001ms 3.690ms 3.694ms 3.700ms 3.775ms 2.35% 10.768 133.642 0.18% 0.000ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
profile_add_sample_frames_x1000 execution_time [3.688ms; 3.690ms] or [-0.025%; +0.025%] None None None

Group 17

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
write only interface execution_time 1.239µs 3.244µs ± 1.452µs 3.009µs ± 0.031µs 3.035µs 3.723µs 14.145µs 15.110µs 402.23% 7.258 54.247 44.65% 0.103µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
write only interface execution_time [3.043µs; 3.446µs] or [-6.204%; +6.204%] None None None

Group 18

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
benching string interning on wordpress profile execution_time 161.079µs 161.557µs ± 0.447µs 161.451µs ± 0.133µs 161.630µs 162.139µs 163.463µs 165.210µs 2.33% 4.367 27.174 0.28% 0.032µs 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
benching string interning on wordpress profile execution_time [161.495µs; 161.619µs] or [-0.038%; +0.038%] None None None

Group 19

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 38c8e3c 1763612845 levi/try_add_sample2
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
benching serializing traces from their internal representation to msgpack execution_time 14.838ms 14.899ms ± 0.034ms 14.896ms ± 0.016ms 14.911ms 14.955ms 15.042ms 15.081ms 1.24% 2.093 7.204 0.23% 0.002ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
benching serializing traces from their internal representation to msgpack execution_time [14.894ms; 14.904ms] or [-0.031%; +0.031%] None None None

Baseline

Omitted due to size.

@codecov-commenter
Copy link

codecov-commenter commented Nov 17, 2025

Codecov Report

❌ Patch coverage is 91.53005% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.31%. Comparing base (89b7a8e) to head (38c8e3c).

Additional details and impacted files
@@                     Coverage Diff                      @@
##           levi/profiles_dictionary    #1351      +/-   ##
============================================================
+ Coverage                     71.15%   71.31%   +0.15%     
============================================================
  Files                           396      399       +3     
  Lines                         62798    63164     +366     
============================================================
+ Hits                          44685    45043     +358     
- Misses                        18113    18121       +8     
Components Coverage Δ
libdd-crashtracker 59.88% <ø> (-0.04%) ⬇️
libdd-crashtracker-ffi 15.31% <ø> (ø)
libdd-alloc 98.73% <ø> (ø)
libdd-data-pipeline 86.00% <ø> (ø)
libdd-data-pipeline-ffi 77.63% <ø> (ø)
libdd-common 80.93% <ø> (ø)
libdd-common-ffi 73.90% <ø> (ø)
libdd-telemetry 60.02% <ø> (ø)
libdd-telemetry-ffi 21.24% <ø> (ø)
libdd-dogstatsd-client 83.75% <ø> (ø)
datadog-ipc 82.61% <ø> (ø)
libdd-profiling 80.07% <91.53%> (+0.63%) ⬆️
libdd-profiling-ffi 62.13% <ø> (ø)
datadog-sidecar 36.98% <ø> (ø)
datdog-sidecar-ffi 16.40% <ø> (ø)
spawn-worker 55.18% <ø> (ø)
libdd-tinybytes 92.44% <ø> (ø)
libdd-trace-normalization 98.24% <ø> (ø)
datadog-trace-obfuscation 94.17% <ø> (ø)
libdd-trace-protobuf 59.65% <ø> (ø)
libdd-trace-utils 90.25% <ø> (ø)
datadog-tracer-flare 62.06% <ø> (ø)
libdd-log 75.57% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@datadog-official
Copy link

datadog-official bot commented Nov 18, 2025

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 38c8e3c | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@dd-octo-sts
Copy link

dd-octo-sts bot commented Nov 18, 2025

Artifact Size Benchmark Report

aarch64-alpine-linux-musl
Artifact Baseline Commit Change
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 7.38 MB 7.38 MB 0% (0 B) 👌
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.a 85.96 MB 86.01 MB +.05% (+50.53 KB) 🔍
aarch64-apple-darwin
Artifact Baseline Commit Change
/aarch64-apple-darwin/lib/libdatadog_profiling.a 57.99 MB 58.05 MB +.09% (+56.70 KB) 🔍
/aarch64-apple-darwin/lib/libdatadog_profiling.dylib 8.43 MB 8.43 MB +.02% (+2.34 KB) 🔍
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 99.70 MB 99.75 MB +.05% (+55.70 KB) 🔍
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 9.53 MB 9.54 MB +.03% (+3.09 KB) 🔍
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 19.57 MB 19.60 MB +.16% (+32.50 KB) 🔍
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 69.82 KB 69.82 KB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 138.54 MB 139.28 MB +.53% (+760.00 KB) 🔍
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 735.58 MB 739.16 MB +.48% (+3.58 MB) 🔍
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 6.34 MB 6.35 MB +.13% (+9.00 KB) 🔍
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 69.82 KB 69.82 KB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 19.67 MB 19.69 MB +.07% (+16.00 KB) 🔍
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 38.64 MB 38.67 MB +.07% (+30.08 KB) 🔍
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 16.70 MB 16.72 MB +.14% (+24.00 KB) 🔍
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 70.90 KB 70.90 KB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 141.11 MB 141.83 MB +.51% (+744.00 KB) 🔍
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 724.31 MB 727.57 MB +.44% (+3.25 MB) 🔍
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 4.87 MB 4.87 MB +.06% (+3.00 KB) 🔍
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 70.90 KB 70.90 KB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 20.90 MB 20.92 MB +.11% (+24.00 KB) 🔍
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 36.39 MB 36.41 MB +.07% (+28.52 KB) 🔍
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 74.32 MB 74.37 MB +.06% (+51.00 KB) 🔍
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 8.85 MB 8.85 MB 0% (0 B) 👌
x86_64-apple-darwin
Artifact Baseline Commit Change
/x86_64-apple-darwin/lib/libdatadog_profiling.a 59.35 MB 59.41 MB +.09% (+56.78 KB) 🔍
/x86_64-apple-darwin/lib/libdatadog_profiling.dylib 9.47 MB 9.48 MB +.06% (+6.32 KB) 🔍
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 93.93 MB 93.98 MB +.05% (+54.00 KB) 🔍
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.28 MB 10.29 MB +.02% (+2.42 KB) 🔍

@morrisonlevi morrisonlevi marked this pull request as ready for review November 18, 2025 16:11
@morrisonlevi morrisonlevi requested a review from a team as a code owner November 18, 2025 16:11
Comment on lines 404 to 408
pub fn try_new2(
profiles_dictionary: crate::profiles::collections::Arc<ProfilesDictionary>,
sample_types: &[ValueType2],
period: Option<Period2>,
) -> io::Result<Self> {
Copy link
Contributor Author

@morrisonlevi morrisonlevi Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having tried this out in PHP, I've decided that it's too much churn in the code to do this at this time. I'm going to adjust the signature so that it takes ValueType and Period rather than ValueType2 and Period2 (and remove the *2 types in these cases). I will keep the profiles_dictionary argument but rename the method, maybe try_new_with_dictionary or something.

Comment on lines +20 to +21
// SAFETY: the profiles_dictionary keeps the storage for Ids alive.
unsafe impl Send for ProfilesDictionaryTranslator {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not clear how this is sufficient to establish Send

};
use indexmap::map::Entry;

pub struct ProfilesDictionaryTranslator {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose and expected uses for this class

Comment on lines +21 to +37
#[derive(Copy, Clone, Debug, Default)]
pub struct Label<'a> {
pub key: StringId2,

/// At most one of `.str` and `.num` should not be empty.
pub str: &'a str,
pub num: i64,

/// Should only be present when num is present.
/// Specifies the units of num.
/// Use arbitrary string (for example, "requests") as a custom count unit.
/// If no unit is specified, consumer may apply heuristic to deduce the unit.
/// Consumers may also interpret units like "bytes" and "kilobytes" as memory
/// units and units like "seconds" and "nanoseconds" as time units,
/// and apply appropriate unit conversions to these.
pub num_unit: &'a str,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to use Rust enums here to enforce this?

labels: L,
timestamp: Option<Timestamp>,
) -> anyhow::Result<()> {
let Some(translator) = &mut self.profiles_dictionary_translator else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to use anyhow, since that can allocate on error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, not really, but that kind of thinking is what slowed down the past efforts I made. Each little thing adds up.

Comment on lines +205 to +206
let mut lbls = Vec::new();
lbls.try_reserve_exact(labels.len())?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this because with_capacity can panic?

Comment on lines +402 to +403
#[inline(never)]
#[cold]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How often do you make new Profile objects? I'd consider once per minute pretty cold, wouldn't you?

Comment on lines +41 to +42
let function2 = (unsafe { id2.read() }).unwrap_or_default();
let set_id = unsafe { core::mem::transmute::<FunctionId2, SetId<dt::Function>>(id2) };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

safety comments

return Ok(*internal);
}

let (name, system_name, filename) = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the advantage of the tuple here

Comment on lines +58 to +61
let internal_id = functions.dedup(function);
self.functions.try_reserve(1)?;
self.functions.insert(set_id, internal_id);
Ok(internal_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this both functions and self.functions? Why do we need both

let Some(mapping2) = (unsafe { id2.read() }) else {
return Ok(None);
};
let set_id = unsafe { core::mem::transmute::<MappingId2, SetId<dt::Mapping>>(id2) };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've noticed a bunch of these transmutes. Why are they needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, safety comment

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.

4 participants