dart-sdk/benchmarks
Stephen Adams a4294c354c Benchmark for comparing reading Uint8List vs UnmodifiableUint8ListView
The benchmark reports per-element times for summing the elements of a typed-data List.

----

The VM implementation is quite good but it looks like there is still a little room for improvement since the views are 2x slower than a simple array.

dart compile exe:

TypedDataPoly.mono.array.2(RunTime): 1.9670880036279512 ns.
TypedDataPoly.A_V.array.2(RunTime): 4.392355 ns.
TypedDataPoly.A_V.view.2(RunTime): 5.730097499999999 ns.
TypedDataPoly.A_UV.array.2(RunTime): 4.455393750000001 ns.
TypedDataPoly.A_UV.view.2(RunTime): 5.811122500000001 ns.
TypedDataPoly.A_VUV.array.2(RunTime): 4.386336250000001 ns.
TypedDataPoly.A_VUV.view.2(RunTime): 5.7639675 ns.
TypedDataPoly.A_UVx5.array.2(RunTime): 4.62768 ns.
TypedDataPoly.A_UVx5.view.2(RunTime): 5.7099649999999995 ns.
TypedDataPoly.mega.array.2(RunTime): 5.272632499999999 ns.
TypedDataPoly.mega.mixed.2(RunTime): 5.62861 ns.

TypedDataPoly.mono.array.100(RunTime): 0.6455633088733822 ns.
TypedDataPoly.A_V.array.100(RunTime): 3.1558100965636964 ns.
TypedDataPoly.A_V.view.100(RunTime): 4.476973567105732 ns.
TypedDataPoly.A_UV.array.100(RunTime): 3.149724878714137 ns.
TypedDataPoly.A_UV.view.100(RunTime): 4.500062299750802 ns.
TypedDataPoly.A_VUV.array.100(RunTime): 3.1438380581862146 ns.
TypedDataPoly.A_VUV.view.100(RunTime): 4.499246259421757 ns.
TypedDataPoly.A_UVx5.array.100(RunTime): 3.1570175999999996 ns.
TypedDataPoly.A_UVx5.view.100(RunTime): 4.482889818440727 ns.
TypedDataPoly.mega.array.100(RunTime): 3.649420567570034 ns.
TypedDataPoly.mega.mixed.100(RunTime): 4.068594455581881 ns.


On the other hand, there is a massive performance tax for using UnmodifiableUint8ListView on the web, especially views of views.
https://github.com/dart-lang/sdk/issues/50255 discusses how this might be fixed.

compile js -O3:

TypedDataPoly.mono.array.2(RunTime): 2.209502118308509 ns.
TypedDataPoly.A_V.array.2(RunTime): 2.58625 ns.
TypedDataPoly.A_V.view.2(RunTime): 2.32 ns.
TypedDataPoly.A_UV.array.2(RunTime): 51.633530557495135 ns.
TypedDataPoly.A_UV.view.2(RunTime): 302.4986387561256 ns.
TypedDataPoly.A_VUV.array.2(RunTime): 52.19476512355694 ns.
TypedDataPoly.A_VUV.view.2(RunTime): 302.84394312113756 ns.
TypedDataPoly.A_UVx5.array.2(RunTime): 55.649763488505165 ns.
TypedDataPoly.A_UVx5.view.2(RunTime): 849.458699173131 ns.
TypedDataPoly.mega.array.2(RunTime): 59.75952192382461 ns.
TypedDataPoly.mega.mixed.2(RunTime): 142.7126082991336 ns.

TypedDataPoly.mono.array.100(RunTime): 0.9815000000000002 ns.
TypedDataPoly.A_V.array.100(RunTime): 1.1626947678735444 ns.
TypedDataPoly.A_V.view.100(RunTime): 1.2075 ns.
TypedDataPoly.A_UV.array.100(RunTime): 17.17602868362643 ns.
TypedDataPoly.A_UV.view.100(RunTime): 231.5 ns.
TypedDataPoly.A_VUV.array.100(RunTime): 16.85678073510773 ns.
TypedDataPoly.A_VUV.view.100(RunTime): 229.7 ns.
TypedDataPoly.A_UVx5.array.100(RunTime): 17.01657458563536 ns.
TypedDataPoly.A_UVx5.view.100(RunTime): 697.5524475524476 ns.
TypedDataPoly.mega.array.100(RunTime): 22.770700636942674 ns.
TypedDataPoly.mega.mixed.100(RunTime): 94.4 ns.

Change-Id: If8878efd4c57bbd87effcd1d3f1339bc0cffbd75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264897
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-10-21 00:53:59 +00:00
..
AsyncLiveVars Roll benchmark_harness and use AsyncBenchmarkBase. 2022-05-02 09:27:49 +00:00
BigIntParsePrint Fixed various typos in a lot of files 2022-07-25 12:21:59 +00:00
Calls [benchmarks/vm] Add benchmarks for #45908 2021-05-27 07:54:14 +00:00
DartCLIStartup [ Benchmarks ] Add benchmarks for SDK snapshot sizes and Dart CLI 2021-05-25 17:52:41 +00:00
Dynamic [benchmark] Add language version comments to benchmarks. 2020-10-13 01:43:22 +00:00
EventLoopLatencyJson [vm] Change EventLoopLatency benchmark to use RunTimeRaw latency 2020-10-23 18:31:01 +00:00
EventLoopLatencyJson350KB [vm/concurrency] Add EventLoopLatencyJson350KB bechmark 2020-10-28 16:28:38 +00:00
EventLoopLatencyRegexp [benchmark] Fix import statement in dart2/EventLoopLatencyRegexp benchmark. 2021-08-24 15:54:14 +00:00
Example Fix typo 2022-08-04 09:22:39 +00:00
FfiAsTypedList [vm/ffi] Optimize Pointer<T>.asTypedList() 2021-11-29 17:38:04 +00:00
FfiBoringssl Reland "[vm/ffi] Roll package:ffi to Allocator and Opaque" 2021-02-10 10:19:28 +00:00
FfiCall Reland "[vm/ffi] Throw on returning Error in Handle" 2022-10-03 12:25:08 +00:00
FfiMemory Reland "[vm/ffi] Add common C types" 2022-01-27 13:09:01 +00:00
FfiStruct Reland "[vm/ffi] Roll package:ffi to Allocator and Opaque" 2021-02-10 10:19:28 +00:00
InstantiateTypeArgs [benchmarks] Address post-review comments for InstantiateTypeArgs. 2022-07-27 08:54:57 +00:00
IntegerSetLookup [gardening] Fix copyright statement typo. 2022-09-15 18:00:59 +00:00
Isolate [benchmarks] Follow-up to "Roll benchmark_harness" 2022-05-02 12:26:41 +00:00
IsolateBaseOverhead [vm/concurrency] Add IsolateBaseOverhead benchmark 2022-05-30 08:14:52 +00:00
IsolateFibonacci [vm/concurrency] Remove --(no-)enable-isolate-groups flag usage in tests 2021-11-04 18:57:21 +00:00
IsolateJson [vm/sendandexit] Introduce Isolate.exit([port, message]). 2021-09-30 20:20:24 +00:00
IsolateSendExitLatency Move benchmark IsolateSendExitLatency to correct directory 2022-06-07 16:50:40 +00:00
IsolateSpawn [benchmark] Add language version comments to benchmarks. 2020-10-13 01:43:22 +00:00
IsolateSpawnMemory [vm/concurrency] Remove --(no-)enable-isolate-groups flag usage in tests 2021-11-04 18:57:21 +00:00
Iterators Add system list polymorphism cases in Iterators benchmark 2022-02-10 18:38:41 +00:00
ListCopy [benchmark] Add language version comments to benchmarks. 2020-10-13 01:43:22 +00:00
MapCopy [benchmark] Add MapCopy benchmark 2022-01-06 03:32:34 +00:00
MapLookup [benchmarks/vm] Add benchmarks for #45908 2021-05-27 07:54:14 +00:00
MD5 [benchmark] Add language version comments to benchmarks. 2020-10-13 01:43:22 +00:00
NativeCall [benchmark] Adds native call benchmark. 2021-11-04 15:16:24 +00:00
ObjectHash Add benchmark for Object.hash 2021-06-30 21:06:34 +00:00
Omnibus Add MapCopy to Omnibus benchmarks 2022-06-28 19:53:23 +00:00
OmnibusDeferred Add MapCopy to Omnibus benchmarks 2022-06-28 19:53:23 +00:00
Richards Fixed various typos in a lot of files 2022-07-25 12:21:59 +00:00
RuntimeType [benchmark] Add language version comments to benchmarks. 2020-10-13 01:43:22 +00:00
SDKArtifactSizes Remove dartanalyzer from SDKArtifactSizes benchmark 2022-07-19 10:51:45 +00:00
SendPort [vm] Prevent tree shaking of fields in SendPort benchmark 2021-07-16 04:39:37 +00:00
SHA1 [benchmark] Add language version comments to benchmarks. 2020-10-13 01:43:22 +00:00
SHA256 [benchmark] Add language version comments to benchmarks. 2020-10-13 01:43:22 +00:00
SkeletalAnimation [benchmark] Add language version comments to benchmarks. 2020-10-13 01:43:22 +00:00
SkeletalAnimationSIMD [benchmark] Add language version comments to benchmarks. 2020-10-13 01:43:22 +00:00
SoundSplayTreeSieve Fix typos 2022-09-16 19:35:00 +00:00
Startup [benchmarks] Apparently Golem has a metric called StartupTime. 2022-04-25 16:44:33 +00:00
StringPool [benchmarks] Add benchmark to measure dart2js string pool cost 2021-06-03 03:11:44 +00:00
TypedDataDuplicate [benchmark] Add language version comments to benchmarks. 2020-10-13 01:43:22 +00:00
TypedDataPoly/dart Benchmark for comparing reading Uint8List vs UnmodifiableUint8ListView 2022-10-21 00:53:59 +00:00
TypeLiteral/dart [vm] Add TypeLiteral benchmark 2022-04-25 08:49:12 +00:00
Utf8Decode [benchmark] Add language version comments to benchmarks. 2020-10-13 01:43:22 +00:00
Utf8Encode [benchmark] Add language version comments to benchmarks. 2020-10-13 01:43:22 +00:00
analysis_options.yaml Roll benchmarks-internal to 02695da98bcf006b95630d3c386f4169d7ec4ecf 2020-06-26 01:56:03 +00:00
OWNERS [infra] Add OWNERS to the Dart SDK 2022-02-14 14:06:34 +00:00