Saving buildGitInfo lambda into a member variable#10615
Saving buildGitInfo lambda into a member variable#10615
Conversation
Unfortunately, profiles show the lambda from this:::buildGitIInfo being a hot allocation point. That would suggest that escape analysis wasn't able to kick in here. So I introduced a member variable to hold the variable to avoid repeatedly allocating
Test Environment - sbt-scalatestJob Status: success
|
Test Environment - nebula-release-pluginJob Status: success
|
There was a problem hiding this comment.
Interesting, I wonder if it's related to the large use of nested lambdas inside buildGitInfo?
EDIT: I'm wondering if it might be because buildGitInfo is not stateless, so the JVM doesn't cache the reference (https://stackoverflow.com/a/23991339)
Test Environment - netflix-zuulJob Status: success
|
Test Environment - reactive-streams-jvmJob Status: success
|
Test Environment - pass4sJob Status: success
|
Test Environment - sonar-kotlinJob Status: success
|
Test Environment - jolokiaJob Status: success
|
Test Environment - okhttpJob Status: success
|
Test Environment - spring_bootJob Status: success
|
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 1 performance regressions! Performance is the same for 61 metrics, 9 unstable metrics.
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.60.0-SNAPSHOT~f0560d1735, baseline=1.60.0-SNAPSHOT~7f66c79293
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.064 s) : 0, 1064180
Total [baseline] (8.793 s) : 0, 8792525
Agent [candidate] (1.064 s) : 0, 1064343
Total [candidate] (8.725 s) : 0, 8724545
section iast
Agent [baseline] (1.235 s) : 0, 1235097
Total [baseline] (9.395 s) : 0, 9394999
Agent [candidate] (1.233 s) : 0, 1233035
Total [candidate] (9.391 s) : 0, 9390883
gantt
title insecure-bank - break down per module: candidate=1.60.0-SNAPSHOT~f0560d1735, baseline=1.60.0-SNAPSHOT~7f66c79293
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.199 ms) : 0, 1199
crashtracking [candidate] (1.191 ms) : 0, 1191
BytebuddyAgent [baseline] (629.807 ms) : 0, 629807
BytebuddyAgent [candidate] (627.421 ms) : 0, 627421
AgentMeter [baseline] (29.056 ms) : 0, 29056
AgentMeter [candidate] (29.116 ms) : 0, 29116
GlobalTracer [baseline] (257.519 ms) : 0, 257519
GlobalTracer [candidate] (257.366 ms) : 0, 257366
AppSec [baseline] (32.804 ms) : 0, 32804
AppSec [candidate] (32.892 ms) : 0, 32892
Debugger [baseline] (60.758 ms) : 0, 60758
Debugger [candidate] (63.557 ms) : 0, 63557
Remote Config [baseline] (643.275 µs) : 0, 643
Remote Config [candidate] (683.746 µs) : 0, 684
Telemetry [baseline] (12.375 ms) : 0, 12375
Telemetry [candidate] (10.632 ms) : 0, 10632
Flare Poller [baseline] (4.526 ms) : 0, 4526
Flare Poller [candidate] (5.303 ms) : 0, 5303
section iast
crashtracking [baseline] (1.182 ms) : 0, 1182
crashtracking [candidate] (1.203 ms) : 0, 1203
BytebuddyAgent [baseline] (798.009 ms) : 0, 798009
BytebuddyAgent [candidate] (796.151 ms) : 0, 796151
AgentMeter [baseline] (11.294 ms) : 0, 11294
AgentMeter [candidate] (11.352 ms) : 0, 11352
GlobalTracer [baseline] (248.975 ms) : 0, 248975
GlobalTracer [candidate] (248.392 ms) : 0, 248392
AppSec [baseline] (34.898 ms) : 0, 34898
AppSec [candidate] (32.605 ms) : 0, 32605
Debugger [baseline] (65.349 ms) : 0, 65349
Debugger [candidate] (67.527 ms) : 0, 67527
Remote Config [baseline] (555.44 µs) : 0, 555
Remote Config [candidate] (533.702 µs) : 0, 534
Telemetry [baseline] (8.657 ms) : 0, 8657
Telemetry [candidate] (8.691 ms) : 0, 8691
Flare Poller [baseline] (3.505 ms) : 0, 3505
Flare Poller [candidate] (3.43 ms) : 0, 3430
IAST [baseline] (27.244 ms) : 0, 27244
IAST [candidate] (26.937 ms) : 0, 26937
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.60.0-SNAPSHOT~f0560d1735, baseline=1.60.0-SNAPSHOT~7f66c79293
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.073 s) : 0, 1073480
Total [baseline] (10.947 s) : 0, 10947293
Agent [candidate] (1.07 s) : 0, 1070018
Total [candidate] (10.872 s) : 0, 10871657
section appsec
Agent [baseline] (1.242 s) : 0, 1241974
Total [baseline] (11.085 s) : 0, 11085099
Agent [candidate] (1.241 s) : 0, 1241429
Total [candidate] (11.0 s) : 0, 11000171
section iast
Agent [baseline] (1.237 s) : 0, 1237230
Total [baseline] (11.281 s) : 0, 11281085
Agent [candidate] (1.231 s) : 0, 1230793
Total [candidate] (11.161 s) : 0, 11160746
section profiling
Agent [baseline] (1.195 s) : 0, 1194553
Total [baseline] (11.051 s) : 0, 11050655
Agent [candidate] (1.194 s) : 0, 1194229
Total [candidate] (11.017 s) : 0, 11017315
gantt
title petclinic - break down per module: candidate=1.60.0-SNAPSHOT~f0560d1735, baseline=1.60.0-SNAPSHOT~7f66c79293
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.197 ms) : 0, 1197
crashtracking [candidate] (1.211 ms) : 0, 1211
BytebuddyAgent [baseline] (633.165 ms) : 0, 633165
BytebuddyAgent [candidate] (631.161 ms) : 0, 631161
AgentMeter [baseline] (29.244 ms) : 0, 29244
AgentMeter [candidate] (29.26 ms) : 0, 29260
GlobalTracer [baseline] (259.511 ms) : 0, 259511
GlobalTracer [candidate] (258.465 ms) : 0, 258465
AppSec [baseline] (33.254 ms) : 0, 33254
AppSec [candidate] (32.843 ms) : 0, 32843
Debugger [baseline] (62.416 ms) : 0, 62416
Debugger [candidate] (67.394 ms) : 0, 67394
Remote Config [baseline] (628.521 µs) : 0, 629
Remote Config [candidate] (613.481 µs) : 0, 613
Telemetry [baseline] (13.121 ms) : 0, 13121
Telemetry [candidate] (9.117 ms) : 0, 9117
Flare Poller [baseline] (5.368 ms) : 0, 5368
Flare Poller [candidate] (3.782 ms) : 0, 3782
section appsec
crashtracking [baseline] (1.196 ms) : 0, 1196
crashtracking [candidate] (1.196 ms) : 0, 1196
BytebuddyAgent [baseline] (658.86 ms) : 0, 658860
BytebuddyAgent [candidate] (659.359 ms) : 0, 659359
AgentMeter [baseline] (12.008 ms) : 0, 12008
AgentMeter [candidate] (11.999 ms) : 0, 11999
GlobalTracer [baseline] (258.561 ms) : 0, 258561
GlobalTracer [candidate] (258.461 ms) : 0, 258461
AppSec [baseline] (168.639 ms) : 0, 168639
AppSec [candidate] (168.415 ms) : 0, 168415
Debugger [baseline] (67.672 ms) : 0, 67672
Debugger [candidate] (66.742 ms) : 0, 66742
Remote Config [baseline] (657.846 µs) : 0, 658
Remote Config [candidate] (643.953 µs) : 0, 644
Telemetry [baseline] (9.871 ms) : 0, 9871
Telemetry [candidate] (9.393 ms) : 0, 9393
Flare Poller [baseline] (3.776 ms) : 0, 3776
Flare Poller [candidate] (3.728 ms) : 0, 3728
IAST [baseline] (25.252 ms) : 0, 25252
IAST [candidate] (25.366 ms) : 0, 25366
section iast
crashtracking [baseline] (1.183 ms) : 0, 1183
crashtracking [candidate] (1.212 ms) : 0, 1212
BytebuddyAgent [baseline] (798.869 ms) : 0, 798869
BytebuddyAgent [candidate] (794.503 ms) : 0, 794503
AgentMeter [baseline] (11.297 ms) : 0, 11297
AgentMeter [candidate] (11.357 ms) : 0, 11357
GlobalTracer [baseline] (249.168 ms) : 0, 249168
GlobalTracer [candidate] (247.709 ms) : 0, 247709
AppSec [baseline] (33.977 ms) : 0, 33977
AppSec [candidate] (32.948 ms) : 0, 32948
Debugger [baseline] (67.462 ms) : 0, 67462
Debugger [candidate] (67.543 ms) : 0, 67543
Remote Config [baseline] (546.74 µs) : 0, 547
Remote Config [candidate] (539.288 µs) : 0, 539
Telemetry [baseline] (8.668 ms) : 0, 8668
Telemetry [candidate] (8.612 ms) : 0, 8612
Flare Poller [baseline] (3.555 ms) : 0, 3555
Flare Poller [candidate] (3.428 ms) : 0, 3428
IAST [baseline] (27.134 ms) : 0, 27134
IAST [candidate] (26.965 ms) : 0, 26965
section profiling
crashtracking [baseline] (1.219 ms) : 0, 1219
crashtracking [candidate] (1.185 ms) : 0, 1185
BytebuddyAgent [baseline] (683.286 ms) : 0, 683286
BytebuddyAgent [candidate] (683.554 ms) : 0, 683554
AgentMeter [baseline] (8.706 ms) : 0, 8706
AgentMeter [candidate] (8.551 ms) : 0, 8551
GlobalTracer [baseline] (216.849 ms) : 0, 216849
GlobalTracer [candidate] (216.263 ms) : 0, 216263
AppSec [baseline] (32.871 ms) : 0, 32871
AppSec [candidate] (32.66 ms) : 0, 32660
Debugger [baseline] (67.967 ms) : 0, 67967
Debugger [candidate] (67.545 ms) : 0, 67545
Remote Config [baseline] (633.366 µs) : 0, 633
Remote Config [candidate] (642.822 µs) : 0, 643
Telemetry [baseline] (9.014 ms) : 0, 9014
Telemetry [candidate] (9.078 ms) : 0, 9078
Flare Poller [baseline] (3.784 ms) : 0, 3784
Flare Poller [candidate] (3.763 ms) : 0, 3763
ProfilingAgent [baseline] (100.111 ms) : 0, 100111
ProfilingAgent [candidate] (100.163 ms) : 0, 100163
Profiling [baseline] (100.693 ms) : 0, 100693
Profiling [candidate] (100.733 ms) : 0, 100733
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 1 performance regressions! Performance is the same for 19 metrics, 16 unstable metrics.
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.60.0-SNAPSHOT~f0560d1735, baseline=1.60.0-SNAPSHOT~7f66c79293
dateFormat X
axisFormat %s
section baseline
no_agent (1.193 ms) : 1180, 1206
. : milestone, 1193,
iast (3.135 ms) : 3094, 3176
. : milestone, 3135,
iast_FULL (5.783 ms) : 5725, 5841
. : milestone, 5783,
iast_GLOBAL (3.605 ms) : 3551, 3659
. : milestone, 3605,
profiling (2.059 ms) : 2042, 2077
. : milestone, 2059,
tracing (1.785 ms) : 1770, 1799
. : milestone, 1785,
section candidate
no_agent (1.168 ms) : 1157, 1179
. : milestone, 1168,
iast (3.149 ms) : 3110, 3187
. : milestone, 3149,
iast_FULL (5.912 ms) : 5853, 5972
. : milestone, 5912,
iast_GLOBAL (3.617 ms) : 3565, 3670
. : milestone, 3617,
profiling (2.218 ms) : 2198, 2238
. : milestone, 2218,
tracing (1.771 ms) : 1757, 1785
. : milestone, 1771,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.60.0-SNAPSHOT~f0560d1735, baseline=1.60.0-SNAPSHOT~7f66c79293
dateFormat X
axisFormat %s
section baseline
no_agent (17.939 ms) : 17756, 18122
. : milestone, 17939,
appsec (18.537 ms) : 18346, 18729
. : milestone, 18537,
code_origins (17.474 ms) : 17298, 17651
. : milestone, 17474,
iast (17.511 ms) : 17337, 17685
. : milestone, 17511,
profiling (18.631 ms) : 18445, 18817
. : milestone, 18631,
tracing (17.788 ms) : 17607, 17968
. : milestone, 17788,
section candidate
no_agent (19.002 ms) : 18805, 19198
. : milestone, 19002,
appsec (18.256 ms) : 18069, 18443
. : milestone, 18256,
code_origins (17.656 ms) : 17482, 17831
. : milestone, 17656,
iast (17.621 ms) : 17447, 17795
. : milestone, 17621,
profiling (18.314 ms) : 18129, 18498
. : milestone, 18314,
tracing (17.747 ms) : 17569, 17926
. : milestone, 17747,
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 biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.60.0-SNAPSHOT~f0560d1735, baseline=1.60.0-SNAPSHOT~7f66c79293
dateFormat X
axisFormat %s
section baseline
no_agent (14.944 s) : 14944000, 14944000
. : milestone, 14944000,
appsec (15.141 s) : 15141000, 15141000
. : milestone, 15141000,
iast (18.361 s) : 18361000, 18361000
. : milestone, 18361000,
iast_GLOBAL (18.024 s) : 18024000, 18024000
. : milestone, 18024000,
profiling (15.085 s) : 15085000, 15085000
. : milestone, 15085000,
tracing (14.572 s) : 14572000, 14572000
. : milestone, 14572000,
section candidate
no_agent (15.563 s) : 15563000, 15563000
. : milestone, 15563000,
appsec (14.795 s) : 14795000, 14795000
. : milestone, 14795000,
iast (18.31 s) : 18310000, 18310000
. : milestone, 18310000,
iast_GLOBAL (18.28 s) : 18280000, 18280000
. : milestone, 18280000,
profiling (14.855 s) : 14855000, 14855000
. : milestone, 14855000,
tracing (14.789 s) : 14789000, 14789000
. : milestone, 14789000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.60.0-SNAPSHOT~f0560d1735, baseline=1.60.0-SNAPSHOT~7f66c79293
dateFormat X
axisFormat %s
section baseline
no_agent (1.483 ms) : 1471, 1494
. : milestone, 1483,
appsec (3.78 ms) : 3564, 3997
. : milestone, 3780,
iast (2.267 ms) : 2197, 2336
. : milestone, 2267,
iast_GLOBAL (2.314 ms) : 2245, 2384
. : milestone, 2314,
profiling (2.103 ms) : 2046, 2159
. : milestone, 2103,
tracing (2.079 ms) : 2025, 2133
. : milestone, 2079,
section candidate
no_agent (1.476 ms) : 1464, 1487
. : milestone, 1476,
appsec (3.816 ms) : 3593, 4039
. : milestone, 3816,
iast (2.263 ms) : 2193, 2332
. : milestone, 2263,
iast_GLOBAL (2.306 ms) : 2236, 2376
. : milestone, 2306,
profiling (2.101 ms) : 2046, 2156
. : milestone, 2101,
tracing (2.06 ms) : 2006, 2114
. : milestone, 2060,
|
Yes, very likely. We could also solve this by making DDCache have a routine that takes an extra context argument. |
Test Environment - sonar-javaJob Status: success
|
What Does This Do
Saving buildGitInfo lambda into a member variable
Motivation
Unfortunately, profiles show the lambda from this::buildGitInfo was a hot allocation point. That would suggest that escape analysis wasn't able to kick in here.
So I introduced a member variable to hold the variable to avoid repeatedly allocating
Additional Notes
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.