-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce context helpers API #8134
base: master
Are you sure you want to change the base?
Conversation
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 59 metrics, 4 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.45.0-SNAPSHOT~d1483fa14b, baseline=1.45.0-SNAPSHOT~e8df8a0d00
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.05 s) : 0, 1050457
Total [baseline] (10.414 s) : 0, 10414393
Agent [candidate] (1.06 s) : 0, 1059931
Total [candidate] (10.487 s) : 0, 10486700
section appsec
Agent [baseline] (1.187 s) : 0, 1187089
Total [baseline] (10.696 s) : 0, 10695577
Agent [candidate] (1.186 s) : 0, 1186263
Total [candidate] (10.724 s) : 0, 10724165
section iast
Agent [baseline] (1.188 s) : 0, 1187506
Total [baseline] (10.99 s) : 0, 10990294
Agent [candidate] (1.18 s) : 0, 1180358
Total [candidate] (10.992 s) : 0, 10992091
section profiling
Agent [baseline] (1.276 s) : 0, 1275836
Total [baseline] (10.897 s) : 0, 10897268
Agent [candidate] (1.285 s) : 0, 1284864
Total [candidate] (10.867 s) : 0, 10867390
gantt
title petclinic - break down per module: candidate=1.45.0-SNAPSHOT~d1483fa14b, baseline=1.45.0-SNAPSHOT~e8df8a0d00
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (712.647 ms) : 0, 712647
BytebuddyAgent [candidate] (718.044 ms) : 0, 718044
GlobalTracer [baseline] (256.352 ms) : 0, 256352
GlobalTracer [candidate] (258.855 ms) : 0, 258855
AppSec [baseline] (55.112 ms) : 0, 55112
AppSec [candidate] (55.589 ms) : 0, 55589
Remote Config [baseline] (718.521 µs) : 0, 719
Remote Config [candidate] (735.456 µs) : 0, 735
Telemetry [baseline] (10.613 ms) : 0, 10613
Telemetry [candidate] (11.488 ms) : 0, 11488
section appsec
BytebuddyAgent [baseline] (729.413 ms) : 0, 729413
BytebuddyAgent [candidate] (728.452 ms) : 0, 728452
GlobalTracer [baseline] (253.327 ms) : 0, 253327
GlobalTracer [candidate] (253.567 ms) : 0, 253567
AppSec [baseline] (170.912 ms) : 0, 170912
AppSec [candidate] (170.485 ms) : 0, 170485
Remote Config [baseline] (665.111 µs) : 0, 665
Remote Config [candidate] (657.559 µs) : 0, 658
Telemetry [baseline] (8.062 ms) : 0, 8062
Telemetry [candidate] (8.01 ms) : 0, 8010
IAST [baseline] (19.454 ms) : 0, 19454
IAST [candidate] (20.033 ms) : 0, 20033
section iast
BytebuddyAgent [baseline] (835.28 ms) : 0, 835280
BytebuddyAgent [candidate] (829.369 ms) : 0, 829369
GlobalTracer [baseline] (248.359 ms) : 0, 248359
GlobalTracer [candidate] (247.013 ms) : 0, 247013
AppSec [baseline] (58.086 ms) : 0, 58086
AppSec [candidate] (58.359 ms) : 0, 58359
Remote Config [baseline] (653.798 µs) : 0, 654
Remote Config [candidate] (672.719 µs) : 0, 673
Telemetry [baseline] (8.639 ms) : 0, 8639
Telemetry [candidate] (8.591 ms) : 0, 8591
IAST [baseline] (21.421 ms) : 0, 21421
IAST [candidate] (21.267 ms) : 0, 21267
section profiling
BytebuddyAgent [baseline] (702.913 ms) : 0, 702913
BytebuddyAgent [candidate] (707.453 ms) : 0, 707453
GlobalTracer [baseline] (372.332 ms) : 0, 372332
GlobalTracer [candidate] (376.509 ms) : 0, 376509
AppSec [baseline] (54.033 ms) : 0, 54033
AppSec [candidate] (53.968 ms) : 0, 53968
Remote Config [baseline] (689.623 µs) : 0, 690
Remote Config [candidate] (676.814 µs) : 0, 677
Telemetry [baseline] (7.958 ms) : 0, 7958
Telemetry [candidate] (7.805 ms) : 0, 7805
ProfilingAgent [baseline] (96.031 ms) : 0, 96031
ProfilingAgent [candidate] (96.315 ms) : 0, 96315
Profiling [baseline] (96.055 ms) : 0, 96055
Profiling [candidate] (96.339 ms) : 0, 96339
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.45.0-SNAPSHOT~d1483fa14b, baseline=1.45.0-SNAPSHOT~e8df8a0d00
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.052 s) : 0, 1051702
Total [baseline] (8.641 s) : 0, 8640906
Agent [candidate] (1.051 s) : 0, 1051260
Total [candidate] (8.604 s) : 0, 8603712
section iast
Agent [baseline] (1.178 s) : 0, 1177824
Total [baseline] (9.249 s) : 0, 9248770
Agent [candidate] (1.18 s) : 0, 1179800
Total [candidate] (9.2 s) : 0, 9199569
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.187 s) : 0, 1186727
Total [baseline] (9.22 s) : 0, 9219904
Agent [candidate] (1.179 s) : 0, 1178530
Total [candidate] (9.19 s) : 0, 9189913
section iast_TELEMETRY_OFF
Agent [baseline] (1.18 s) : 0, 1179860
Total [baseline] (9.239 s) : 0, 9239067
Agent [candidate] (1.179 s) : 0, 1179143
Total [candidate] (9.248 s) : 0, 9248479
gantt
title insecure-bank - break down per module: candidate=1.45.0-SNAPSHOT~d1483fa14b, baseline=1.45.0-SNAPSHOT~e8df8a0d00
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (711.929 ms) : 0, 711929
BytebuddyAgent [candidate] (712.207 ms) : 0, 712207
GlobalTracer [baseline] (256.29 ms) : 0, 256290
GlobalTracer [candidate] (256.794 ms) : 0, 256794
AppSec [baseline] (55.07 ms) : 0, 55070
AppSec [candidate] (55.215 ms) : 0, 55215
Remote Config [baseline] (710.684 µs) : 0, 711
Remote Config [candidate] (720.76 µs) : 0, 721
Telemetry [baseline] (12.686 ms) : 0, 12686
Telemetry [candidate] (11.288 ms) : 0, 11288
section iast
BytebuddyAgent [baseline] (828.054 ms) : 0, 828054
BytebuddyAgent [candidate] (828.843 ms) : 0, 828843
GlobalTracer [baseline] (246.275 ms) : 0, 246275
GlobalTracer [candidate] (246.956 ms) : 0, 246956
AppSec [baseline] (57.713 ms) : 0, 57713
AppSec [candidate] (58.261 ms) : 0, 58261
IAST [baseline] (21.624 ms) : 0, 21624
IAST [candidate] (21.443 ms) : 0, 21443
Remote Config [baseline] (682.889 µs) : 0, 683
Remote Config [candidate] (660.708 µs) : 0, 661
Telemetry [baseline] (8.572 ms) : 0, 8572
Telemetry [candidate] (8.509 ms) : 0, 8509
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (834.269 ms) : 0, 834269
BytebuddyAgent [candidate] (827.23 ms) : 0, 827230
GlobalTracer [baseline] (247.793 ms) : 0, 247793
GlobalTracer [candidate] (247.186 ms) : 0, 247186
AppSec [baseline] (58.669 ms) : 0, 58669
AppSec [candidate] (58.319 ms) : 0, 58319
IAST [baseline] (21.626 ms) : 0, 21626
IAST [candidate] (21.601 ms) : 0, 21601
Remote Config [baseline] (668.025 µs) : 0, 668
Remote Config [candidate] (658.55 µs) : 0, 659
Telemetry [baseline] (8.622 ms) : 0, 8622
Telemetry [candidate] (8.501 ms) : 0, 8501
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (827.775 ms) : 0, 827775
BytebuddyAgent [candidate] (829.075 ms) : 0, 829075
GlobalTracer [baseline] (248.089 ms) : 0, 248089
GlobalTracer [candidate] (247.523 ms) : 0, 247523
AppSec [baseline] (58.562 ms) : 0, 58562
AppSec [candidate] (57.578 ms) : 0, 57578
IAST [baseline] (21.262 ms) : 0, 21262
IAST [candidate] (20.823 ms) : 0, 20823
Remote Config [baseline] (680.4 µs) : 0, 680
Remote Config [candidate] (642.824 µs) : 0, 643
Telemetry [baseline] (8.559 ms) : 0, 8559
Telemetry [candidate] (8.342 ms) : 0, 8342
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 16 unstable metrics. Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.45.0-SNAPSHOT~d1483fa14b, baseline=1.45.0-SNAPSHOT~e8df8a0d00
dateFormat X
axisFormat %s
section baseline
no_agent (380.021 µs) : 360, 400
. : milestone, 380,
iast (490.555 µs) : 469, 512
. : milestone, 491,
iast_FULL (649.814 µs) : 628, 671
. : milestone, 650,
iast_GLOBAL (524.961 µs) : 503, 547
. : milestone, 525,
iast_HARDCODED_SECRET_DISABLED (489.421 µs) : 468, 511
. : milestone, 489,
iast_INACTIVE (453.204 µs) : 432, 475
. : milestone, 453,
iast_TELEMETRY_OFF (482.971 µs) : 461, 505
. : milestone, 483,
tracing (443.44 µs) : 423, 464
. : milestone, 443,
section candidate
no_agent (376.63 µs) : 357, 396
. : milestone, 377,
iast (494.069 µs) : 473, 516
. : milestone, 494,
iast_FULL (655.015 µs) : 633, 677
. : milestone, 655,
iast_GLOBAL (522.045 µs) : 500, 544
. : milestone, 522,
iast_HARDCODED_SECRET_DISABLED (492.276 µs) : 471, 514
. : milestone, 492,
iast_INACTIVE (464.03 µs) : 442, 486
. : milestone, 464,
iast_TELEMETRY_OFF (485.851 µs) : 463, 508
. : milestone, 486,
tracing (446.362 µs) : 426, 467
. : milestone, 446,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.45.0-SNAPSHOT~d1483fa14b, baseline=1.45.0-SNAPSHOT~e8df8a0d00
dateFormat X
axisFormat %s
section baseline
no_agent (1.358 ms) : 1339, 1378
. : milestone, 1358,
appsec (1.754 ms) : 1731, 1778
. : milestone, 1754,
appsec_no_iast (1.753 ms) : 1728, 1779
. : milestone, 1753,
iast (1.514 ms) : 1491, 1537
. : milestone, 1514,
profiling (1.565 ms) : 1541, 1589
. : milestone, 1565,
tracing (1.495 ms) : 1470, 1519
. : milestone, 1495,
section candidate
no_agent (1.36 ms) : 1340, 1380
. : milestone, 1360,
appsec (1.769 ms) : 1746, 1793
. : milestone, 1769,
appsec_no_iast (1.754 ms) : 1729, 1778
. : milestone, 1754,
iast (1.502 ms) : 1479, 1526
. : milestone, 1502,
profiling (1.548 ms) : 1522, 1573
. : milestone, 1548,
tracing (1.473 ms) : 1448, 1498
. : milestone, 1473,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics. Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.45.0-SNAPSHOT~d1483fa14b, baseline=1.45.0-SNAPSHOT~e8df8a0d00
dateFormat X
axisFormat %s
section baseline
no_agent (14.904 s) : 14904000, 14904000
. : milestone, 14904000,
appsec (15.208 s) : 15208000, 15208000
. : milestone, 15208000,
iast (18.835 s) : 18835000, 18835000
. : milestone, 18835000,
iast_GLOBAL (17.758 s) : 17758000, 17758000
. : milestone, 17758000,
profiling (14.915 s) : 14915000, 14915000
. : milestone, 14915000,
tracing (14.866 s) : 14866000, 14866000
. : milestone, 14866000,
section candidate
no_agent (14.901 s) : 14901000, 14901000
. : milestone, 14901000,
appsec (15.012 s) : 15012000, 15012000
. : milestone, 15012000,
iast (18.458 s) : 18458000, 18458000
. : milestone, 18458000,
iast_GLOBAL (18.076 s) : 18076000, 18076000
. : milestone, 18076000,
profiling (14.991 s) : 14991000, 14991000
. : milestone, 14991000,
tracing (14.985 s) : 14985000, 14985000
. : milestone, 14985000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.45.0-SNAPSHOT~d1483fa14b, baseline=1.45.0-SNAPSHOT~e8df8a0d00
dateFormat X
axisFormat %s
section baseline
no_agent (1.465 ms) : 1454, 1476
. : milestone, 1465,
appsec (2.344 ms) : 2302, 2386
. : milestone, 2344,
iast (2.082 ms) : 2029, 2135
. : milestone, 2082,
iast_GLOBAL (2.129 ms) : 2076, 2183
. : milestone, 2129,
profiling (1.973 ms) : 1930, 2017
. : milestone, 1973,
tracing (1.939 ms) : 1898, 1980
. : milestone, 1939,
section candidate
no_agent (1.467 ms) : 1455, 1478
. : milestone, 1467,
appsec (2.346 ms) : 2304, 2387
. : milestone, 2346,
iast (2.082 ms) : 2029, 2135
. : milestone, 2082,
iast_GLOBAL (2.129 ms) : 2076, 2182
. : milestone, 2129,
profiling (1.975 ms) : 1932, 2018
. : milestone, 1975,
tracing (1.929 ms) : 1888, 1969
. : milestone, 1929,
|
if (store[nextSingleton.index] == null) { | ||
store[nextSingleton.index] = nextSingleton.value; | ||
} | ||
return new IndexedContext(store); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor improvement: we can save an array allocation if we check whether we have a value for the index first:
SingletonContext nextSingleton = (SingletonContext) next;
if (nextSingleton.index < currentIndexed.store.length && currentIndexed.store[nextSingleton.index] != null) {
return current;
}
Object[] store =
copyOfRange(
currentIndexed.store, 0, max(currentIndexed.store.length, nextSingleton.index + 1));
store[nextSingleton.index] = nextSingleton.value;
return new IndexedContext(store);
store[i] = nextValue; | ||
} | ||
} | ||
return new IndexedContext(store); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise here we could iterate over nextIndexed
and only create a new store if either nextIndexed.store
has more elements or it has a non-null
element that is null
in the currentIndexed.store
. It should be possible to do this in a single pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback. The original implementation used to support every merge possible between all three implementations (so 9 different cases) and I did not dare doing too many optimizations as it was a nightmare to get them fully covered by test.
As I simplified the overall merge by using a 0-length IndexedContext
as original input, I end up with only 3 merges to support, and they are now worth optimization. Thanks for catching it! 🙏
a41844e
to
d1483fa
Compare
What Does This Do
This PR introduces few helper methods to help manipulate context and carrier collections.
Motivation
This should help with Context adoption and make its usage simpler while not enriching Context interface itself.
Additional Notes
The helper API comes from the Context API scratchpad discussions and are open to feedback.
The more we get, the best they will be.
Contributor Checklist
type:
and (comp:
orinst:
) labels in addition to any usefull labelsclose
,fix
or any linking keywords when referencing an issue.Use
solves
instead, and assign the PR milestone to the issueJira ticket: LANGPLAT-39