Commit graph

4 commits

Author SHA1 Message Date
Martin Kustermann af1b5b8044 [dart2wasm] Switch binaryen optimization levels from -O3 to -Os
We want dart2wasm be comparable to dart2js / dart2aot, the ladder two
are much more conservative with inlining compared to current dart2wasm.

The -O3 is described in the binaryen sources as agressive for
performance and therefore willing to compromise code size.

The -Os is more nuanced: It will perform many optimizations that are
done in -O3 (and e.g. not in -O2) but it will make inlining less
agressive.

This reduces flute compile-time by 10% and code size by 10%
This benchmark results are mixed (some things get faster, some things
slower). Naturally there'll be specialized micro benchmarks that
get hit hard by this.

Where performance matters we should rather make dart2wasm use better
inlining heuristics and annotate code with
`@pragma('wasm:prefer-inline')`

Change-Id: Idf7e75e4e385629c9cec66359efe0afe50db3e72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352523
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-02-14 13:45:13 +00:00
Stephen Adams 5239a7836e [benchmarks] Update TypedDataPoly benchmark
Update TypedDataPoly benchmark to use `asUnmodifiableView()` instead
of the deprecated typed data view constructors.

Bug: #53785
Change-Id: I02381e3db37f44b01da25d7cbd728b525ff4899e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332161
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-10-27 16:56:03 +00:00
Josh Soref 9e4dc755cb Spelling pkg
Closes https://github.com/dart-lang/sdk/pull/50921

GitOrigin-RevId: 6b1ca502b6722b0a987f33ace66f65cbd2c24e23
Change-Id: I74e4ff3c8e759c576036d6b791bd7734ebd215d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278536
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-01-19 10:06:29 +00:00
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