Creating HashingUtils as alternative to Objects.hash#10628
Open
Creating HashingUtils as alternative to Objects.hash#10628
Conversation
Adding HashingUtils which is a replacement for the hashing routines of java.util.Objects. HashingUtils is specifically designed to avoid var-args allocation which can lead to lots of allocation if hashCode is hot. To demonstrate the potential impact see HashingBenchmark
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 63 metrics, 8 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.60.0-SNAPSHOT~4f7064fd8e, baseline=1.60.0-SNAPSHOT~7f66c79293
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.077 s) : 0, 1076795
Total [baseline] (8.789 s) : 0, 8789384
Agent [candidate] (1.068 s) : 0, 1067662
Total [candidate] (8.758 s) : 0, 8758369
section iast
Agent [baseline] (1.241 s) : 0, 1241402
Total [baseline] (9.372 s) : 0, 9371670
Agent [candidate] (1.243 s) : 0, 1242733
Total [candidate] (9.399 s) : 0, 9399229
gantt
title insecure-bank - break down per module: candidate=1.60.0-SNAPSHOT~4f7064fd8e, baseline=1.60.0-SNAPSHOT~7f66c79293
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.201 ms) : 0, 1201
crashtracking [candidate] (1.186 ms) : 0, 1186
BytebuddyAgent [baseline] (636.017 ms) : 0, 636017
BytebuddyAgent [candidate] (630.718 ms) : 0, 630718
AgentMeter [baseline] (29.415 ms) : 0, 29415
AgentMeter [candidate] (29.065 ms) : 0, 29065
GlobalTracer [baseline] (260.719 ms) : 0, 260719
GlobalTracer [candidate] (258.493 ms) : 0, 258493
AppSec [baseline] (33.512 ms) : 0, 33512
AppSec [candidate] (32.834 ms) : 0, 32834
Debugger [baseline] (64.2 ms) : 0, 64200
Debugger [candidate] (61.602 ms) : 0, 61602
Remote Config [baseline] (627.244 µs) : 0, 627
Remote Config [candidate] (634.451 µs) : 0, 634
Telemetry [baseline] (11.661 ms) : 0, 11661
Telemetry [candidate] (11.574 ms) : 0, 11574
Flare Poller [baseline] (3.815 ms) : 0, 3815
Flare Poller [candidate] (6.098 ms) : 0, 6098
section iast
crashtracking [baseline] (1.2 ms) : 0, 1200
crashtracking [candidate] (1.193 ms) : 0, 1193
BytebuddyAgent [baseline] (802.736 ms) : 0, 802736
BytebuddyAgent [candidate] (803.639 ms) : 0, 803639
AgentMeter [baseline] (11.535 ms) : 0, 11535
AgentMeter [candidate] (11.537 ms) : 0, 11537
GlobalTracer [baseline] (249.626 ms) : 0, 249626
GlobalTracer [candidate] (249.797 ms) : 0, 249797
AppSec [baseline] (35.205 ms) : 0, 35205
AppSec [candidate] (35.085 ms) : 0, 35085
Debugger [baseline] (65.315 ms) : 0, 65315
Debugger [candidate] (65.728 ms) : 0, 65728
Remote Config [baseline] (544.531 µs) : 0, 545
Remote Config [candidate] (541.068 µs) : 0, 541
Telemetry [baseline] (8.691 ms) : 0, 8691
Telemetry [candidate] (8.676 ms) : 0, 8676
Flare Poller [baseline] (3.496 ms) : 0, 3496
Flare Poller [candidate] (3.526 ms) : 0, 3526
IAST [baseline] (27.439 ms) : 0, 27439
IAST [candidate] (27.52 ms) : 0, 27520
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.60.0-SNAPSHOT~4f7064fd8e, baseline=1.60.0-SNAPSHOT~7f66c79293
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.074 s) : 0, 1073514
Total [baseline] (11.032 s) : 0, 11031601
Agent [candidate] (1.07 s) : 0, 1069735
Total [candidate] (10.825 s) : 0, 10825244
section appsec
Agent [baseline] (1.242 s) : 0, 1241774
Total [baseline] (11.025 s) : 0, 11024905
Agent [candidate] (1.24 s) : 0, 1239778
Total [candidate] (11.11 s) : 0, 11109660
section iast
Agent [baseline] (1.247 s) : 0, 1247352
Total [baseline] (11.255 s) : 0, 11254665
Agent [candidate] (1.233 s) : 0, 1233191
Total [candidate] (11.288 s) : 0, 11287753
section profiling
Agent [baseline] (1.201 s) : 0, 1201243
Total [baseline] (11.05 s) : 0, 11049572
Agent [candidate] (1.19 s) : 0, 1189990
Total [candidate] (10.998 s) : 0, 10997859
gantt
title petclinic - break down per module: candidate=1.60.0-SNAPSHOT~4f7064fd8e, baseline=1.60.0-SNAPSHOT~7f66c79293
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.193 ms) : 0, 1193
crashtracking [candidate] (1.181 ms) : 0, 1181
BytebuddyAgent [baseline] (634.24 ms) : 0, 634240
BytebuddyAgent [candidate] (631.257 ms) : 0, 631257
AgentMeter [baseline] (29.162 ms) : 0, 29162
AgentMeter [candidate] (29.056 ms) : 0, 29056
GlobalTracer [baseline] (259.199 ms) : 0, 259199
GlobalTracer [candidate] (258.18 ms) : 0, 258180
AppSec [baseline] (33.388 ms) : 0, 33388
AppSec [candidate] (32.987 ms) : 0, 32987
Debugger [baseline] (62.031 ms) : 0, 62031
Debugger [candidate] (62.64 ms) : 0, 62640
Remote Config [baseline] (657.308 µs) : 0, 657
Remote Config [candidate] (625.471 µs) : 0, 625
Telemetry [baseline] (13.4 ms) : 0, 13400
Telemetry [candidate] (11.401 ms) : 0, 11401
Flare Poller [baseline] (4.576 ms) : 0, 4576
Flare Poller [candidate] (7.022 ms) : 0, 7022
section appsec
crashtracking [baseline] (1.185 ms) : 0, 1185
crashtracking [candidate] (1.182 ms) : 0, 1182
BytebuddyAgent [baseline] (659.114 ms) : 0, 659114
BytebuddyAgent [candidate] (659.03 ms) : 0, 659030
AgentMeter [baseline] (11.965 ms) : 0, 11965
AgentMeter [candidate] (11.955 ms) : 0, 11955
GlobalTracer [baseline] (258.456 ms) : 0, 258456
GlobalTracer [candidate] (258.254 ms) : 0, 258254
AppSec [baseline] (168.761 ms) : 0, 168761
AppSec [candidate] (168.202 ms) : 0, 168202
Debugger [baseline] (67.464 ms) : 0, 67464
Debugger [candidate] (66.828 ms) : 0, 66828
Remote Config [baseline] (669.393 µs) : 0, 669
Remote Config [candidate] (636.276 µs) : 0, 636
Telemetry [baseline] (9.735 ms) : 0, 9735
Telemetry [candidate] (9.496 ms) : 0, 9496
Flare Poller [baseline] (3.721 ms) : 0, 3721
Flare Poller [candidate] (3.585 ms) : 0, 3585
IAST [baseline] (25.237 ms) : 0, 25237
IAST [candidate] (25.204 ms) : 0, 25204
section iast
crashtracking [baseline] (1.196 ms) : 0, 1196
crashtracking [candidate] (1.181 ms) : 0, 1181
BytebuddyAgent [baseline] (806.6 ms) : 0, 806600
BytebuddyAgent [candidate] (797.344 ms) : 0, 797344
AgentMeter [baseline] (11.431 ms) : 0, 11431
AgentMeter [candidate] (11.23 ms) : 0, 11230
GlobalTracer [baseline] (250.962 ms) : 0, 250962
GlobalTracer [candidate] (248.025 ms) : 0, 248025
AppSec [baseline] (32.648 ms) : 0, 32648
AppSec [candidate] (34.545 ms) : 0, 34545
Debugger [baseline] (68.655 ms) : 0, 68655
Debugger [candidate] (65.861 ms) : 0, 65861
Remote Config [baseline] (553.836 µs) : 0, 554
Remote Config [candidate] (549.852 µs) : 0, 550
Telemetry [baseline] (8.634 ms) : 0, 8634
Telemetry [candidate] (8.615 ms) : 0, 8615
Flare Poller [baseline] (3.486 ms) : 0, 3486
Flare Poller [candidate] (3.457 ms) : 0, 3457
IAST [baseline] (27.453 ms) : 0, 27453
IAST [candidate] (26.962 ms) : 0, 26962
section profiling
ProfilingAgent [baseline] (100.298 ms) : 0, 100298
ProfilingAgent [candidate] (99.634 ms) : 0, 99634
crashtracking [baseline] (1.242 ms) : 0, 1242
crashtracking [candidate] (1.215 ms) : 0, 1215
BytebuddyAgent [baseline] (688.822 ms) : 0, 688822
BytebuddyAgent [candidate] (682.12 ms) : 0, 682120
AgentMeter [baseline] (8.668 ms) : 0, 8668
AgentMeter [candidate] (8.627 ms) : 0, 8627
GlobalTracer [baseline] (217.283 ms) : 0, 217283
GlobalTracer [candidate] (215.487 ms) : 0, 215487
AppSec [baseline] (32.986 ms) : 0, 32986
AppSec [candidate] (32.445 ms) : 0, 32445
Debugger [baseline] (68.141 ms) : 0, 68141
Debugger [candidate] (67.237 ms) : 0, 67237
Remote Config [baseline] (637.462 µs) : 0, 637
Remote Config [candidate] (629.486 µs) : 0, 629
Telemetry [baseline] (8.889 ms) : 0, 8889
Telemetry [candidate] (8.911 ms) : 0, 8911
Flare Poller [baseline] (3.787 ms) : 0, 3787
Flare Poller [candidate] (3.747 ms) : 0, 3747
Profiling [baseline] (100.873 ms) : 0, 100873
Profiling [candidate] (100.213 ms) : 0, 100213
LoadParameters
See matching parameters
SummaryFound 3 performance improvements and 2 performance regressions! Performance is the same for 15 metrics, 16 unstable metrics.
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.60.0-SNAPSHOT~4f7064fd8e, baseline=1.60.0-SNAPSHOT~7f66c79293
dateFormat X
axisFormat %s
section baseline
no_agent (17.448 ms) : 17271, 17625
. : milestone, 17448,
appsec (19.149 ms) : 18954, 19343
. : milestone, 19149,
code_origins (17.782 ms) : 17603, 17961
. : milestone, 17782,
iast (18.732 ms) : 18544, 18920
. : milestone, 18732,
profiling (19.704 ms) : 19505, 19903
. : milestone, 19704,
tracing (18.63 ms) : 18446, 18813
. : milestone, 18630,
section candidate
no_agent (17.941 ms) : 17765, 18117
. : milestone, 17941,
appsec (18.772 ms) : 18578, 18966
. : milestone, 18772,
code_origins (17.793 ms) : 17615, 17971
. : milestone, 17793,
iast (17.879 ms) : 17697, 18061
. : milestone, 17879,
profiling (18.688 ms) : 18502, 18874
. : milestone, 18688,
tracing (17.758 ms) : 17581, 17935
. : milestone, 17758,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.60.0-SNAPSHOT~4f7064fd8e, baseline=1.60.0-SNAPSHOT~7f66c79293
dateFormat X
axisFormat %s
section baseline
no_agent (1.167 ms) : 1155, 1178
. : milestone, 1167,
iast (3.185 ms) : 3146, 3224
. : milestone, 3185,
iast_FULL (5.801 ms) : 5744, 5858
. : milestone, 5801,
iast_GLOBAL (3.495 ms) : 3446, 3543
. : milestone, 3495,
profiling (2.143 ms) : 2123, 2163
. : milestone, 2143,
tracing (1.783 ms) : 1768, 1797
. : milestone, 1783,
section candidate
no_agent (1.171 ms) : 1160, 1182
. : milestone, 1171,
iast (3.189 ms) : 3143, 3235
. : milestone, 3189,
iast_FULL (6.092 ms) : 6030, 6155
. : milestone, 6092,
iast_GLOBAL (3.641 ms) : 3588, 3694
. : milestone, 3641,
profiling (2.074 ms) : 2055, 2093
. : milestone, 2074,
tracing (1.779 ms) : 1764, 1794
. : milestone, 1779,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 1 unstable metrics. Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.60.0-SNAPSHOT~4f7064fd8e, baseline=1.60.0-SNAPSHOT~7f66c79293
dateFormat X
axisFormat %s
section baseline
no_agent (1.473 ms) : 1461, 1484
. : milestone, 1473,
appsec (3.755 ms) : 3534, 3976
. : milestone, 3755,
iast (2.253 ms) : 2184, 2322
. : milestone, 2253,
iast_GLOBAL (2.296 ms) : 2226, 2365
. : milestone, 2296,
profiling (2.099 ms) : 2043, 2156
. : milestone, 2099,
tracing (2.065 ms) : 2011, 2119
. : milestone, 2065,
section candidate
no_agent (1.467 ms) : 1456, 1479
. : milestone, 1467,
appsec (3.716 ms) : 3500, 3932
. : milestone, 3716,
iast (2.258 ms) : 2188, 2327
. : milestone, 2258,
iast_GLOBAL (2.295 ms) : 2225, 2365
. : milestone, 2295,
profiling (2.07 ms) : 2016, 2125
. : milestone, 2070,
tracing (2.064 ms) : 2010, 2118
. : milestone, 2064,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.60.0-SNAPSHOT~4f7064fd8e, baseline=1.60.0-SNAPSHOT~7f66c79293
dateFormat X
axisFormat %s
section baseline
no_agent (15.335 s) : 15335000, 15335000
. : milestone, 15335000,
appsec (14.849 s) : 14849000, 14849000
. : milestone, 14849000,
iast (18.155 s) : 18155000, 18155000
. : milestone, 18155000,
iast_GLOBAL (17.974 s) : 17974000, 17974000
. : milestone, 17974000,
profiling (15.429 s) : 15429000, 15429000
. : milestone, 15429000,
tracing (14.794 s) : 14794000, 14794000
. : milestone, 14794000,
section candidate
no_agent (15.328 s) : 15328000, 15328000
. : milestone, 15328000,
appsec (14.727 s) : 14727000, 14727000
. : milestone, 14727000,
iast (18.432 s) : 18432000, 18432000
. : milestone, 18432000,
iast_GLOBAL (17.987 s) : 17987000, 17987000
. : milestone, 17987000,
profiling (15.112 s) : 15112000, 15112000
. : milestone, 15112000,
tracing (15.163 s) : 15163000, 15163000
. : milestone, 15163000,
|
amarziali
reviewed
Feb 19, 2026
| @Fork(2) | ||
| @Warmup(iterations = 2) | ||
| @Measurement(iterations = 3) | ||
| @Threads(8) |
Contributor
There was a problem hiding this comment.
perhaps this adds only noise comparing doing it on a single core
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Does This Do
Adds HashingUtils which is a replacement for the hashing routines of java.util.Objects.
Motivation
HashingUtils is specifically designed to avoid var-args allocation which can lead to lots of allocation if hashCode is hot.
HashingBenchmark shows a 3-4x improvement in throughput with HashingUtils.hash vs Objects.hash,
but more importantly no allocation as compared to GiB/secc with Objects.hash.
Additional Notes
In a subsequent PR, I'll update callers of Objects.hash to call HashingUtils.hash instead.
Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]
Note: Once your PR is ready to merge, add it to the merge queue by commenting
/merge./merge -ccancels the queue request./merge -f --reason "reason"skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see this doc.