diff options
author | Tobias Thierer <tobiast@google.com> | 2018-07-04 17:55:23 +0100 |
---|---|---|
committer | Tobias Thierer <tobiast@google.com> | 2018-07-04 18:41:04 +0100 |
commit | 615af4beb606edc393becc2f2d9078cdb46d93f0 (patch) | |
tree | f2a9f96254f8a81dc220e4dd550f1af9d7b742a6 /include/ScopedJavaUnicodeString.h | |
parent | 43dc1d55b7b030213ffebce6ad26bc4c2f573d40 (diff) |
Add benchmark for System.getProperty() vs. AccessController/GetPropertyAction.
Comparing the performance of these options is interesting because
libcore carries patches to short-circuit such logic in a few places.
This CL came out of a verbal discussion of http://r.android.com/710427
Benchmark results on a 5.5" Google Pixel device from 2016:
Using the legacy security code costs approx. 500 nanoseconds
per invocation (1136 vs. 1061 ns) when not specifying a default value,
or, or 320 nanoseconds (1041 vs. 710 ns) when specifying a default
value (1061 vs. 740 ns).
Both properties that are accessed (user.language and user.region)
have nonempty values on the device that was tested.
I ran the benchmark a couple of times; here's the output from one run:
Trial Report (1 of 4):
Experiment {instrument=runtime, benchmarkMethod=timeAccessController_getPropertyAction, vm=default, parameters={}}
Results:
runtime(ns): min=1136.75, 1st qu.=1136.75, median=1136.75, mean=1136.75, 3rd qu.=1136.75, max=1136.75
Trial Report (2 of 4):
Experiment {instrument=runtime, benchmarkMethod=timeAccessController_getPropertyAction_default, vm=default, parameters={}}
Results:
runtime(ns): min=1061.38, 1st qu.=1061.38, median=1061.38, mean=1061.38, 3rd qu.=1061.38, max=1061.38
Trial Report (3 of 4):
Experiment {instrument=runtime, benchmarkMethod=timeSystem_getProperty, vm=default, parameters={}}
Results:
runtime(ns): min=634.09, 1st qu.=634.09, median=634.09, mean=634.09, 3rd qu.=634.09, max=634.09
Trial Report (4 of 4):
Experiment {instrument=runtime, benchmarkMethod=timeSystem_getProperty_default, vm=default, parameters={}}
Results:
runtime(ns): min=740.08, 1st qu.=740.08, median=740.08, mean=740.08, 3rd qu.=740.08, max=740.08
Test: vogar --benchmark --verbose benchmarks/GetSystemPropertyBenchmark.java
Change-Id: I77461a5007351b144b2dc09ac7c194240332636d
Diffstat (limited to 'include/ScopedJavaUnicodeString.h')
0 files changed, 0 insertions, 0 deletions