Commit graph

188 commits

Author SHA1 Message Date
Alexander Markov 6897b9e331 [benchmarks] Micro-benchmark for multiple returns
The new micro-benchmark measures performance of returning 2 values
via list, dedicated class, record and a record with named fields.
Requires '--enable-experiment=records' flag to run.

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I895d955efb2fc4f1c04b31b113cd8e01db47132a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265121
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-10-25 17:02:21 +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
Daco Harkes b113fffb65 Reland "[vm/ffi] Throw on returning Error in Handle"
Fix: Check handle contents for Smi.
Closes: https://github.com/flutter/flutter/issues/112726

Orignal CL description:

Makes `Dart_Handle` FFI returns behave as the following snippet:

```
Dart_Handle ExampleSnippet() {
  Dart_Handle result = ...;
  if (Dart_IsError(result)) {
    Dart_PropagateError(result);
  }
  return result;
}
```

Also makes FFI consistent with Dart_NativeFunctions, which will
automatically throw upon return if Dart_SetReturnValue set the result
to an error.

`UnhandledExceptions` cannot flow out into Dart generated code. So,
the implementation needs to be in `FfiCallInstr::EmitNativeCode`.

Using `Dart_IsError` is slow compared to a machine code class id
check. So, we should do the handle unwrapping and class id check in
machine code.

Unwrapping Handles in machine code is only safe when the GC is
guaranteed to not run: Either (1) in `kThreadInGenerated`, or (2) in
`kThreadInNative`, but only when transitioned into safepoint. So, the
handle cannot be unwrapped immediately after the FFI call in machine code. We first need to transition back to generated.

This means we need to transition again to native to do the actual
`Dart_PropagateError` call. We can do so without the stub in JIT
because we never return with normal control flow.

Performance impact of this change is within benchmark noise in both
JIT and AOT.
Size impact is 42 bytes on x64, which is 10% in AOT and 12% in JIT.

For more numbers see: go/dart-ffi-handle-error

TEST=runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc
TEST=tests/ffi/vmspecific_handle_test.dart

Closes: https://github.com/dart-lang/sdk/issues/49936
Change-Id: Id8edfd841a7d6246438386007d83747868a0a151
Cq-Include-Trybots: luci.dart.try:vm-canary-linux-debug-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-kernel-gcc-linux-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-msvc-windows-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-tsan-linux-release-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-win-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262342
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-10-03 12:25:08 +00:00
Zach Anderson 2742d90033 Revert "[vm/ffi] Throw on returning Error in Handle"
This reverts commit d9c442bce8.

Reason for revert: https://github.com/flutter/flutter/issues/112726

Original change's description:
> [vm/ffi] Throw on returning `Error` in `Handle`
>
> Makes `Dart_Handle` FFI returns behave as the following snippet:
>
> ```
> Dart_Handle ExampleSnippet() {
>   Dart_Handle result;
>   if (Dart_IsError(result)) {
>     Dart_PropagateError(result);
>   }
>   return result;
> }
> ```
>
> Also makes FFI consistent with Dart_NativeFunctions, which will
> automatically throw upon return if Dart_SetReturnValue set the result
> to an error.
>
> `UnhandledExceptions` cannot flow out into Dart generated code. So,
> the implementation needs to be in `FfiCallInstr::EmitNativeCode`.
>
> Using `Dart_IsError` is slow compared to a machine code class id
> check. So, we should do the handle unwrapping and class id check in
> machine code.
>
> Unwrapping Handles in machine code is only safe when the GC is
> guaranteed to not run: Either (1) in `kThreadInGenerated`, or (2) in
> `kThreadInNative`, but only when transitioned into safepoint. So, the
> handle cannot be unwrapped immediately after the FFI call in machine code. We first need to transition back to generated.
>
> This means we need to transition again to native to do the actual
> `Dart_PropagateError` call. We can do so without the stub in JIT
> because we never return with normal control flow.
>
> Performance impact of this change is within benchmark noise in both
> JIT and AOT.
> Size impact is 42 bytes on x64, which is 10% in AOT and 12% in JIT.
>
> For more numbers see: go/dart-ffi-handle-error
>
> TEST=runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc
> TEST=tests/ffi/vmspecific_handle_test.dart
>
> Closes: https://github.com/dart-lang/sdk/issues/49936
> Change-Id: Ie8fabeb6d53bc80689541bc4470cb37ee2200581
> Cq-Include-Trybots: luci.dart.try:vm-canary-linux-debug-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-kernel-gcc-linux-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-msvc-windows-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-tsan-linux-release-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-win-debug-x64c-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261603
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Daco Harkes <dacoharkes@google.com>

TBR=kustermann@google.com,rmacnak@google.com,dacoharkes@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I94cc63de16b54db2b0a4f92759c39a1e569b8e63
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-canary-linux-debug-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-kernel-gcc-linux-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-msvc-windows-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-tsan-linux-release-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-win-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262270
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2022-09-30 21:51:59 +00:00
Daco Harkes d9c442bce8 [vm/ffi] Throw on returning Error in Handle
Makes `Dart_Handle` FFI returns behave as the following snippet:

```
Dart_Handle ExampleSnippet() {
  Dart_Handle result;
  if (Dart_IsError(result)) {
    Dart_PropagateError(result);
  }
  return result;
}
```

Also makes FFI consistent with Dart_NativeFunctions, which will
automatically throw upon return if Dart_SetReturnValue set the result
to an error.

`UnhandledExceptions` cannot flow out into Dart generated code. So,
the implementation needs to be in `FfiCallInstr::EmitNativeCode`.

Using `Dart_IsError` is slow compared to a machine code class id
check. So, we should do the handle unwrapping and class id check in
machine code.

Unwrapping Handles in machine code is only safe when the GC is
guaranteed to not run: Either (1) in `kThreadInGenerated`, or (2) in
`kThreadInNative`, but only when transitioned into safepoint. So, the
handle cannot be unwrapped immediately after the FFI call in machine code. We first need to transition back to generated.

This means we need to transition again to native to do the actual
`Dart_PropagateError` call. We can do so without the stub in JIT
because we never return with normal control flow.

Performance impact of this change is within benchmark noise in both
JIT and AOT.
Size impact is 42 bytes on x64, which is 10% in AOT and 12% in JIT.

For more numbers see: go/dart-ffi-handle-error

TEST=runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc
TEST=tests/ffi/vmspecific_handle_test.dart

Closes: https://github.com/dart-lang/sdk/issues/49936
Change-Id: Ie8fabeb6d53bc80689541bc4470cb37ee2200581
Cq-Include-Trybots: luci.dart.try:vm-canary-linux-debug-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-kernel-gcc-linux-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-msvc-windows-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-tsan-linux-release-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-win-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261603
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-09-30 13:29:51 +00:00
Ahmed Ashour 5fe480b788 Fix typos
Fix #49864

TEST=ci

Change-Id: I9a7e06d604cd0b4f56f2ac229ab3fc9f01cb9d76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256824
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2022-09-16 19:35:00 +00:00
Alexander Aprelev 995f542d79 [gardening] Fix copyright statement typo.
TEST=ci

Change-Id: Iaccabdf361d491d2a6c5a82d0ac23db0036d6e4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259461
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-09-15 18:00:59 +00:00
Alexander Aprelev 2ca5300faf [benchmarks] Add sets of integers lookup benchmarks.
This measures performance of integer hashCode.

BUG=https://github.com/dart-lang/sdk/issues/48641
TEST=ci

Change-Id: I276d26127137c70d59581b3689b2319b8e123c1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259240
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-09-14 22:52:43 +00:00
mnordine dbd65b829f Fix typo
Closes https://github.com/dart-lang/sdk/pull/49591

GitOrigin-RevId: 9af48bbb20623b93b2c68f87ebc7cda3d6b481c7
Change-Id: I565d52b7781fd85ea39c87e51534aaec1e266149
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253610
Reviewed-by: Michael Thomsen <mit@google.com>
2022-08-04 09:22:39 +00:00
Tess Strickland 27dc7de6d6 [benchmarks] Address post-review comments for InstantiateTypeArgs.
Change-Id: I7af16d3b10867f0cebabaf4579539889627cd234
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252741
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-07-27 08:54:57 +00:00
Tess Strickland 2df264a2a8 [benchmarks] Adding benchmarks for type argument instantiation.
The primary focus of the new benchmarks is measuring the current
overhead of caching instantiated versions of the type arguments
in the uninstantiated type argument.

Change-Id: If611e72ac4f7a94c82f58d06cc34dcef2b8382df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252423
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-07-26 07:53:17 +00:00
Anis Alibegić 40e18905f2 Fixed various typos in a lot of files
Closes https://github.com/dart-lang/sdk/pull/49478

TEST=Manual

GitOrigin-RevId: f4c9c6869dfe73639295e86574a021523b3d374d
Change-Id: I134a97caed4eec59d70e9cbca16b7e9a472cf2c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251902
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-07-25 12:21:59 +00:00
William Hesse 3eaf01a242 Remove dartanalyzer from SDKArtifactSizes benchmark
Bug: https://github.com/dart-lang/sdk/issues/48457
Change-Id: I42d2053e193f903ccf1eb9f351c0890dbd2231d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251945
Reviewed-by: Michael Thomsen <mit@google.com>
2022-07-19 10:51:45 +00:00
Stephen Adams 87c5c968cd Add MapCopy to Omnibus benchmarks
Change-Id: I911f914294b275600be894f227250927f05d74af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231535
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-06-28 19:53:23 +00:00
William Hesse eb12216408 Move benchmark IsolateSendExitLatency to correct directory
A benchmark should be in a directory with the same name as
the benchmark main file.

Bug: https://github.com/dart-lang/sdk/issues/49050
Change-Id: I31c0a9f276d313ab43d61be8ac3833b77ae8ee47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247387
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Auto-Submit: William Hesse <whesse@google.com>
2022-06-07 16:50:40 +00:00
Alexander Aprelev 74b606f7f7 [benchmark] Add IsolateSendExitLatency benchmark.
This measures latency induced by one isolate send-and-exiting on concurrently running isolates.

The benchmark report format mimics EventLoopLatency benchmark, in a way it reports "runtime" as a latency.

TEST=manual run of benchmarks

Bug: https://github.com/dart-lang/sdk/issues/49050
Change-Id: I20642fd75bd24870658d553b0775f62083544bdb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246620
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-06-01 16:09:24 +00:00
Martin Kustermann e566f9a14b [vm/concurrency] Add IsolateBaseOverhead benchmark
Issue b/190877061

TEST=ci

Change-Id: Ifa570492b440849252a9bd01c7782656bcce7fd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245984
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-05-30 08:14:52 +00:00
William Hesse 55082e9cd7 [benchmarks] Follow-up to "Roll benchmark_harness"
The dart2/Isolate benchmark restricts the view of benchmark_harness
with a "show" clause. Removed it, and fixed the benchmark.

Change-Id: I99a4bdf00b88a3a69d8e6db1c0fa46dd85cc4aab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243264
Auto-Submit: William Hesse <whesse@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2022-05-02 12:26:41 +00:00
Jonas Termansen 630302b710 Roll benchmark_harness and use AsyncBenchmarkBase.
Change-Id: I9089b566082d06cb4947e9720cbafedccc901a60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242872
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-05-02 09:27:49 +00:00
Ryan Macnak b4b0868b40 [benchmarks] Apparently Golem has a metric called StartupTime.
Change-Id: Id4375435ffeda6a442dc6963323d8d494e8344ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242360
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-04-25 16:44:33 +00:00
Martin Kustermann b341480a72 [vm] Add TypeLiteral benchmark
This benchmark tests the performance of uninstantiated type literal
usages.

Issue https://github.com/dart-lang/sdk/issues/48757

TEST=ci

Change-Id: I5eb881a2b8e397997505af41b24240afcbe9d1ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242104
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-04-25 08:49:12 +00:00
Ryan Macnak 633803df35 [benchmarks] Use the RunTimeRaw metric for Startup.
It makes more sense for Golem to display the benchmark results as a time than as a rate.

Change-Id: Iba262c98e9dc0d07983107966fa9b8d479e1b529
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242064
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-04-21 23:05:38 +00:00
Ryan Macnak 6cea65bab7 [benchmarks] Add benchmark to record various startup durations.
TEST=ci
Change-Id: I65b298aa3f4a1ddf7752dc787e0a2ff1c2cacff8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241840
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-04-20 22:48:38 +00:00
Alexander Markov b55dc762fa [benchmarks] Add micro-benchmark for async/await with live variables
Issue: https://github.com/dart-lang/sdk/issues/48594
Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: Ib5bd65c149342bb5d9bb2b5176a4a3b968a08a81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238980
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-03-30 18:25:00 +00:00
William Hesse 53a9e2045f Remove size benchmarks for discontinued snapshots
Bug: https://github.com/dart-lang/sdk/issues/46100
Change-Id: I6eefd91ea92c345c62b03ad145ed535abc5e3f26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233182
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: William Hesse <whesse@google.com>
2022-02-16 12:27:41 +00:00
Alexander Thomas 30beab0f43 [infra] Add OWNERS to the Dart SDK
* Add team "groups" in tools/OWNERS_<group name>.
* Add top-level OWNERS as a fallback.
* Add OWNERS for all top-level directories.
* Add OWNERS to all packages.

For additional background information see go/dart-sdk-owners.

TEST=No op until code-owners is enabled.
Bug: b/200915407
Change-Id: I7fe6116cc599c749cd50ca16151d6d6a801d99d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229147
Reviewed-by: Jonas Termansen <sortie@google.com>
2022-02-14 14:06:34 +00:00
Stephen Adams bb2d193aaf Add system list polymorphism cases in Iterators benchmark
Change-Id: Iee3d126370d314609cd25c8ac015fc360c9ae16f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232202
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-02-10 18:38:41 +00:00
Stephen Adams f85a44cea6 [benchmarks] Add noise to BigIntPrintParse fake results
Change-Id: I1cce5d8066255b489fd4c51395462183cac9728f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227362
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-02-08 20:24:16 +00:00
Stephen Adams be5198d524 [benchmarks] Add benchmark for basic collection Iterables
Change-Id: Ic4a85ed10fbb1ac789433a2347688f89c44b1654
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231186
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-02-04 00:30:56 +00:00
Daco Harkes 045b9c1715 Reland "[vm/ffi] Add common C types"
We're adding these types to `dart:ffi` rather than `package:ffi` so that
they can be used with `FfiNative`s.

Adds `NativeType`s for the following C types:

* unsigned char
* signed char
* short
* unsigned short
* int
* unsigned int
* long
* unsigned long
* long long
* unsigned long long
* uintptr_t
* size_t
* wchar_t

Because the C standard only defines minimum sizes for many of these
types, future platforms might diverge from the typical size even if all
platforms currently agree on a size. To avoid having to reification
later, we define all types as AbiSpecificIntegers rather than typedefs,
even if all current target platforms agree on the size.

Closes: https://github.com/dart-lang/sdk/issues/36140

TEST=tests/ffi/c_types_test.dart

Original patch in patchset 1.

* Removes `Char` for now until package:win32 has rolled to 2.3.8 in
  Flutter. https://pub.dev/packages/win32/versions/2.3.8/changelog
  https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8824468064587445729/+/u/Android_Views_Integration_Tests/stdout
* Adds `c_type.dart` in `ffi_source.gni` which should fix `IntPtr`
  missing when analyzing `path_provider_linux`. (However, I was unable
  to reproduce the issue locally.)
  https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8824468064571399025/+/u/run_test.dart_for_flutter_plugins_shard_and_subshard_analyze/test_stdout
  `/tmp/flutter_plugins.KZMNMC/packages/path_provider/path_provider_linux$ ~/flt/engine/src/out/host_debug/dart-sdk/bin/dart  analyze --fatal-infos`

Change-Id: I89130cccba285fc9c483bb53f5710a302f2b104f
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-canary-linux-debug-try,vm-fuchsia-release-x64-try,vm-kernel-gcc-linux-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-mac-debug-x64-try,vm-kernel-mac-release-arm64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-nnbd-win-release-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-win-release-x64-try,flutter-analyze-try,flutter-engine-linux-try,flutter-frontend-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229156
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-01-27 13:09:01 +00:00
Michael Thomsen 208e7bc2e2 Remove dartdoc commands
Part of previously announced deprecation, see:
https://github.com/dart-lang/sdk/issues/46100

Fixes https://github.com/dart-lang/sdk/issues/44610

Change-Id: Ic3eaa793149da412b7520b154a0909ee59fbfb5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228647
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2022-01-27 08:12:00 +00:00
Daco Harkes 5183ba3ca4 Revert "[vm/ffi] Add common C types"
This reverts commit 85a87ca7ae.

Reason for revert: 

* Adding `Char` breaks `package:win32` which is used in Flutter so it
breaks the Flutter build:
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8824468064587445729/+/u/Android_Views_Integration_Tests/stdout

For reference: full list of Flutter failues:
https://github.com/flutter/flutter/runs/4890844911

Original change's description:
> [vm/ffi] Add common C types
>
> We're adding these types to `dart:ffi` rather than `package:ffi` so that
> they can be used with `FfiNative`s.
>
> Adds `NativeType`s for the following C types:
>
> * char
> * unsigned char
> * signed char
> * short
> * unsigned short
> * int
> * unsigned int
> * long
> * unsigned long
> * long long
> * unsigned long long
> * uintptr_t
> * size_t
> * wchar_t
>
> Because the C standard only defines minimum sizes for many of these
> types, future platforms might diverge from the typical size even if all
> platforms currently agree on a size. To avoid having to reification
> later, we define all types as AbiSpecificIntegers rather than typedefs,
> even if all current target platforms agree on the size.
>
> Closes: https://github.com/dart-lang/sdk/issues/36140
>
> TEST=tests/ffi/c_types_test.dart
>
> Change-Id: Ie97d253856d787386529231e8060f879069be886
> Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-canary-linux-debug-try,vm-fuchsia-release-x64-try,vm-kernel-gcc-linux-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-mac-debug-x64-try,vm-kernel-mac-release-arm64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-nnbd-win-release-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-win-release-x64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228541
> Reviewed-by: Martin Kustermann <kustermann@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Ic56df88c653b1395ed5e5a71af5e571b1adc3671
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229152
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-01-21 17:05:42 +00:00
Daco Harkes 85a87ca7ae [vm/ffi] Add common C types
We're adding these types to `dart:ffi` rather than `package:ffi` so that
they can be used with `FfiNative`s.

Adds `NativeType`s for the following C types:

* char
* unsigned char
* signed char
* short
* unsigned short
* int
* unsigned int
* long
* unsigned long
* long long
* unsigned long long
* uintptr_t
* size_t
* wchar_t

Because the C standard only defines minimum sizes for many of these
types, future platforms might diverge from the typical size even if all
platforms currently agree on a size. To avoid having to reification
later, we define all types as AbiSpecificIntegers rather than typedefs,
even if all current target platforms agree on the size.

Closes: https://github.com/dart-lang/sdk/issues/36140

TEST=tests/ffi/c_types_test.dart

Change-Id: Ie97d253856d787386529231e8060f879069be886
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-canary-linux-debug-try,vm-fuchsia-release-x64-try,vm-kernel-gcc-linux-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-mac-debug-x64-try,vm-kernel-mac-release-arm64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-nnbd-win-release-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228541
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-01-20 14:41:46 +00:00
Ryan Macnak 04ba20aa98 [vm] Support RISC-V.
Implements a backend targeting RV32GC and RV64GC, based on Linux standardizing around GC. The assembler is written to make it easy to disable usage of C, but because the sizes of some instruction sequences are compile-time constants, an additional build configuration would need to be defined to make use of it.

The assembler and disassembler cover every RV32/64GC instruction. The simulator covers all instructions except accessing CSRs and the floating point state accessible through such, include accrued exceptions and dynamic rounding mode.

Quirks:
  - RISC-V is a compare-and-branch architecture, but some existing "architecture-independent" parts of the Dart compiler assume a condition code architecture. To avoid rewriting these parts, we use a peephole in the assembler to map to compare-and-branch. See Assembler::BranchIf. Luckily nothing depended on taking multiple branches on the same condition code set.
  - There are no hardware overflow checks, so we must use Hacker's Delight style software checks. Often these are very cheap: if the sign of one operand is known, a single branch is needed.
  - The ranges of RISC-V branches and jumps are such that we use 3 levels of generation for forward branches, instead of the 2 levels of near and far branches used on ARM[64]. Nearly all code is handled by the first two levels with 20-bits of range, with enormous regex matchers triggering the third level that uses aupic+jalr to get 32-bits of range.
  - For PC-relative calls in AOT, we always generate auipc+jalr pairs with 32-bits of range, so we never generate trampolines.
  - Only a subset of registers are available in some compressed instructions, so we assign the most popular uses to these registers. In particular, THR, TMP[2], CODE and PP. This has the effect of assigning CODE and PP to volatile registers in the C calling convention, whereas they are assigned preserved registers on the other architectures. As on ARM64, PP is untagged; this is so short indices can be accessed with a compressed instruction.
  - There are no push or pop instructions, so combining pushes and pops is preferred so we can update SP once.
  - The C calling convention has a strongly aligned stack, but unlike on ARM64 we don't need to use an alternate stack pointer. The author ensured language was added to the RISC-V psABI making the OS responsible for realigning the stack pointer for signal handlers, allowing Dart to leave the stack pointer misaligned from the C calling convention's point of view until a foreign call.
  - We don't bother with the link register tracking done on ARM[64]. Instead we make use of an alternate link register to avoid inline spilling in the write barrier.

Unimplemented:
 - non-trivial FFI cases
 - Compressed pointers - No intention to implement.
 - Unboxed SIMD - We might make use of the V extension registers when the V extension is ratified.
 - BigInt intrinsics

TEST=existing tests for IL level, new tests for assembler/disassembler/simulator
Bug: https://github.com/dart-lang/sdk/issues/38587
Bug: https://github.com/dart-lang/sdk/issues/48164
Change-Id: I991d1df4be5bf55efec5371b767b332d37dfa3e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217289
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-01-20 00:57:57 +00:00
Stephen Adams d8c8474387 [benchmark] Add MapCopy benchmark
Change-Id: I8684dc9c79f9194999f89de1587a72067ec72426
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225880
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-01-06 03:32:34 +00:00
Daco Harkes acdf82de17 [vm/ffi] ABI-specific integers
This CL adds support for users defining integers which are mapped to
differing sizes and signedness based on the application binary interface
the Dart VM is running on.

Notable implementation design decisions:
- ABIs are open world, so that adding an ABI to the Dart VM does not
  break existing definitions. Thus, we only figure out in the VM that
  we're missing a mapping. We throw compile-time errors.
  - In AOT, these show up in the precompilation step.
  - In JIT, these show up as `_CompileTimeError` at runtime. Note that
    these can be caught. So in subsequent compilation steps we need to
    ensure that we also throw the same compile-time error.
- We match on the call-sites (streaming_flowgraph_builder) rather than
  method bodies (kernel_to_il) of AbiSpecific loads and stores so that
  we can compile for the int-size of the call site.

API design decisions:
https://github.com/dart-lang/sdk/issues/42563#issuecomment-981774001

Closes: https://github.com/dart-lang/sdk/issues/42563

TEST=tests/ffi_2/abi_*_test.dart
TEST=tests/ffi/function_*_generated_test.dart
TEST=tests/ffi/vmspecific_static_checks_test.dart
Change-Id: I8c8df36fab939b6fb614c5f1ee8e1bf46b6e9521
Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try,analyzer-nnbd-linux-release-try,app-kernel-linux-debug-x64-try,benchmark-linux-try,dart-sdk-linux-try,front-end-linux-release-x64-try,front-end-nnbd-linux-release-x64-try,pkg-linux-debug-try,vm-canary-linux-debug-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-fuchsia-release-x64-try,vm-kernel-checked-linux-release-x64-try,vm-kernel-gcc-linux-try,vm-kernel-linux-debug-x64c-try,vm-kernel-mac-debug-x64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-android-release-arm64c-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-win-debug-x64c-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221501
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-12-16 22:07:00 +00:00
Gabriel Terwesten 02549a8bce [vm/ffi] Optimize Pointer<T>.asTypedList()
This change refactors `_asExternalTypedData` into multiple functions,
which are data type specific, e.g `_asExternalTypedDataInt8`.
These functions are implemented as recognized methods.
Argument checks have previously been performed in the removed
runtime entry implementation of `_asExternalTypedData.` These are
now handled in Dart.

TEST=tests/ffi/external_typed_data_test.dart

Closes https://github.com/dart-lang/sdk/issues/39843

Closes https://github.com/dart-lang/sdk/pull/47780
https://github.com/dart-lang/sdk/pull/47780

GitOrigin-RevId: 65763bddd06c633583b4adbf920c32c5a7a3720f
Change-Id: I703b350d89004ebe36e70eaa44dda1d9ebb050c7
Cq-Include-Trybots: luci.dart.try:vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,app-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-linux-debug-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221360
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-11-29 17:38:04 +00:00
Martin Kustermann 96d40d1caa [vm/concurrency] Remove --(no-)enable-isolate-groups flag usage in tests
This is a preparation CL to remove the --enable-isolate-groups flag in
the VM.

The following tests were only running in --no-enable-isolate-groups and
are therefore obsolete now:

  - runtime/tests/vm/dart/regress_47468_test.dart
  - runtime/tests/vm/dart_2/regress_47468_test.dart
  - tests/lib/isolate/illegal_msg_function_test.dart
  - tests/lib_2/isolate/illegal_msg_function_test.dart

TEST=Changes tests only.

Change-Id: I6257cb667eebca66a649614d3010139dd2cdd3ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219100
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-11-04 18:57:21 +00:00
Clement Skau 36652d3b1a [benchmark] Adds native call benchmark.
Adds new benchmarks for native calls, parallel to the
existing benchmark for FFI calls.

This makes it possible (with some caveats) to compare
overheads of calling through native and FFI.

Local results on Linux, x64, AOT (for reference):

NativeCall.Uint8x01(RunTime): 585.9797891036907 us.
NativeCall.Int64x20(RunTime): 1340.2451440053583 us.
NativeCall.Doublex01(RunTime): 694.4875 us.
NativeCall.Doublex20(RunTime): 1610.102172164119 us.
NativeCall.Handlex01(RunTime): 735.7863184994483 us.
NativeCall.Handlex20(RunTime): 836.6783772480134 us.

FfiCall.Uint8x01(RunTime): 202.5837131570951 us.
FfiCall.Int64x20(RunTime): 328.16931911402787 us.
FfiCall.Doublex01(RunTime): 220.58028231142478 us.
FfiCall.Doublex20(RunTime): 373.4350261389096 us.
FfiCall.Handlex01(RunTime): 357.4213724088635 us.
FfiCall.Handlex20(RunTime): 1152.427995391705 us.

TEST=Manually ran benchmark locally.
Change-Id: Ib28455fbd9f739c1e3ba487b932b464fc12b7e04
Cq-Include-Trybots: luci.dart.try:benchmark-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218920
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-11-04 15:16:24 +00:00
Robert Nystrom 1a218ca03f Remove dartfmt from SDK artifact size benchmark.
Dart 2.15 won't contain it as a separate snapshot.

Change-Id: I8f356a4b9c88fd736f755d8f85b68f8e18f6ec78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215182
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-10-01 15:45:53 +00:00
Alexander Aprelev 56403a0d35 [vm/sendandexit] Introduce Isolate.exit([port, message]).
This exits current isolate immediately. If [port] is provided, then [message] is verified and sent out as isolate exits.

TEST=ci
Fixes https://github.com/dart-lang/sdk/issues/47164

Change-Id: I513f4d7ceb5d74820f4aee60f5799b7b5193f2e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214312
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-09-30 20:20:24 +00:00
Alexander Aprelev 62750359d9 [benchmark] Fix import statement in dart2/EventLoopLatencyRegexp benchmark.
This is follow-up to 455a105c42

Change-Id: I346e0174dacad4fcae5285b63f77fe217543f7b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211040
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-08-24 15:54:14 +00:00
Devon Carew 3238d433fa Revise the SDK size benchmark.
Change-Id: Iab9b301737e141a9ad95d4f4e9391a06b5788e6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210760
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2021-08-20 21:47:25 +00:00
Alexander Aprelev 02599e58ae [vm/benchmarks] Ensure EventLoopLatencyRegexp benchmark encapsulated.
Clone latency.dart into the benchmark from EventLoopLatencyJson

Change-Id: I92090b4decf49e67b937d8095bb7c36adf79c509
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210430
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-08-18 14:29:04 +00:00
Tess Strickland 4c47fdbea6 [gardening] Fix SDKArtifactSizes benchmark.
Compress the dart-sdk directory under the root, not the grandparent of
the root which will be the SDK checkout.

Also fix so dart2 version is 2.9 compatible and dart version is
latest version compatible.

Change-Id: I6e8875d9a3c9fdabf301db379340b2d8473a54cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210440
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2021-08-18 09:28:53 +00:00
Devon Carew 8bb5ced986 add a benchmark tracking the dart sdk size
Change-Id: Ibbd23a3c376584711515462620e1a22254214181
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210289
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2021-08-17 16:14:42 +00:00
Alexander Aprelev 455a105c42 [vm/benchmark] Introduce benchmarks that measures event loop latency for regexp processing.
This captures performance issues reported on https://github.com/flutter/flutter/issues/88063

Change-Id: Ie216808a02231be7915c60268718f3e0a0dc3c99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210282
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-08-16 18:41:49 +00:00
Alexander Aprelev 7c772a653b [benchmarks] Add IsolateFibonacci benchmark wrapper around existing test.
Change-Id: I66268cd24bcf55dd75baf7000948dcbe81928001
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209180
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-08-09 15:02:28 +00:00
Martin Kustermann b15f99bdbf [vm] Prevent tree shaking of fields in SendPort benchmark
In AOT the SendPort.{Send,Receive}.BinaryTree.* are really fast, because
the tree shaker will remove the fields, which will make us actually not
construct a tree at all but only one root node without fields.

TEST=Changes benchmark to work as intended

Change-Id: Idbcb1e15613b1fd071591be40c4ffd9eadc86ce5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207121
Auto-Submit: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-07-16 04:39:37 +00:00
Ben Konyi 378ab67916 [ Benchmarks ] Output CodeSize of 0 for missing artifacts on certain
platforms

Change-Id: Iceee212c432524055650a2a008d3023aa84efe82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206585
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-07-12 23:23:38 +00:00
Stephen Adams b0310477d9 Add benchmark for Object.hash
Change-Id: If13333096b337994fd6ad45804812a3a51b90aae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205020
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2021-06-30 21:06:34 +00:00
Martin Kustermann 848449437b [vm/concurrency] Add SendPort.{Send,Receive}.* benchmarks
Other existing benchmarks that are related (e.g. IsolateJson) measure
multiple things at the same time (e.g. utf8 decoding speed, json
decoding speed, isolate communication).

The benchmarks in this CL focus purely on sending object graphs via [SendPort]s
and measure sending and receiving time. As data we measure json
(map/list/string heavy) as well as binary trees (user object heavy).

Issue https://github.com/dart-lang/sdk/issues/36097

TEST=Adding benchmark.

Change-Id: I032b5c63ee386697610ea2873914109789e00137
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203763
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-06-17 10:05:58 +00:00
Ben Konyi 9cf93054ee [ benchmark ] Fix names for SDKArtifactSizes benchmark outputs
Change-Id: I569723b04136d37607a61e5a47a2e8661425f820
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202263
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-06-03 17:26:07 +00:00
Stephen Adams 09b75a3d53 [benchmarks] Add benchmark to measure dart2js string pool cost
Change-Id: I15099af08526444c2e01da46b9939f2435547c90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201981
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2021-06-03 03:11:44 +00:00
Ben Konyi 71238faee8 [ benchmark ] Use '.' instead of '_' to represent sub-benchmarks in SDKArtifactSizes
Change-Id: Ia47f9565025b79440aa179a215db2d7a95b744e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201582
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-05-27 18:14:14 +00:00
Daco Harkes b0bfee6627 [benchmarks/vm] Add benchmarks for #45908
The implementation of const map literals is based on linear lookups in
an array containing key/value pairs instead of a hash table.

Bug: https://github.com/dart-lang/sdk/issues/45908

Golem CL:
https://chrome-internal-review.googlesource.com/c/golem/+/3852562

Change-Id: If0a980339ee1342c41f9388e0bd7b3615a4ef4e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200188
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-05-27 07:54:14 +00:00
Ben Konyi 7767e6acc1 [ Benchmarks ] Add benchmarks for SDK snapshot sizes and Dart CLI
startup time

Change-Id: If0c792036ac377aa3d777f95816e9d1d548326b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201167
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-05-25 17:52:41 +00:00
Clement Skau 4d5055805f [VM/FFI] Adds FFI leaf calls.
This CL adds FFI leaf calls by adding `lookupFunction(.., isLeaf)`
and `_asFunctionInternal(.., isLeaf)`, which generate FFI leaf calls.
These calls skip a lot of the usual frame building and generated <->
native transition overhead.

`benchmark/FfiCall/` shows a 1.1x - 4.3x speed-up between the regular
FFI calls and their leaf call counterparts (JIT, x64, release).

TEST=Adds `tests/ffi{,_2}/vmspecific_leaf_call_test.dart`. Tested FFI tests.

Closes: https://github.com/dart-lang/sdk/issues/36707
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-release-arm64-try,vm-ffi-android-release-arm-try,vm-ffi-android-product-arm64-try,vm-ffi-android-product-arm-try,vm-ffi-android-debug-arm64-try,vm-ffi-android-debug-arm-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-precomp-nnbd-mac-release-simarm64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-precomp-ubsan-linux-release-x64-try,vm-kernel-precomp-tsan-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try
Bug: https://github.com/dart-lang/sdk/issues/36707
Change-Id: Id8824f36b0006bf09951207bd004356fe6e9f46e
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179768
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-05-21 11:12:02 +00:00
Stephen Adams 235ff47a07 [benchmarks] Fix lints in Omnibus benchmarks
Change-Id: I08dd527bcfd3b4ed97d0c57a877c64ff0ec49ade
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196460
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-04-23 20:11:52 +00:00
Stephen Adams e8f5367219 [benchmarks] Move Richards from internal benchmarks to SDK benchmarks
Change-Id: I523b8c29ff97235e2dec0fd50f67ee4e8cd4ef13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195191
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2021-04-15 22:29:07 +00:00
Daco Harkes f820f7ce48 [vm/ffi] Exercise unaligned reads/writes
This CL validates the hypothesis that the only misaligned reads/writes
which are not supported are double and float, and only on arm32.

Running these on the CI and Golem will validate this hypothesis.

Bug: https://github.com/dart-lang/sdk/issues/45009

Change-Id: I0a77fd1f47a388d1f454c1ded50cd7ecaeadb0f0
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,analyzer-analysis-server-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190523
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-03-16 20:17:31 +00:00
Clement Skau 4235154e3d [ffi/benchmark] Refactor FfiCall benchmarks.
Inlines in the test classes:
- Native function lookup.
- The main benchmark loop.

This CL contains the refactoring necessary to update the
benchmarks to include leaf calls, as seen in:
https://dart-review.googlesource.com/c/sdk/+/179768

TEST=tools/build.py -m release dart && out/ReleaseX64/dart benchmarks/FfiCall/dart{,2}/FfiCall.dart

Change-Id: I1e85f991d895862c27ae99a71f5d4785ccdf5676
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188465
Commit-Queue: Clement Skau <cskau@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-03-02 16:06:22 +00:00
Clement Skau 3e7d590a30 [ffi/benchmark] Dedup. test code in FfiCall.
This also serves as a step in the refactoring needed for
the FFI leaf call benchmark changes in:
https://dart-review.googlesource.com/c/sdk/+/179768

Change-Id: I0876d610b1d79b05c4bcd7e3cd9ef48d1beff432
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186294
Auto-Submit: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-02-23 14:45:59 +00:00
Daco Harkes c7422d5277 [benchmarks/ffi] Memory access with asTypedList
Adds benchmarks using `asTypedList` on Pointers to investigate from
where it pays of to do construct a TypedData to do memory access
instead of on the Pointer directly.

x64 JIT results:
- Memory access on TypedData (int8) is ~2,5 faster than on Pointer.
FfiMemory.PointerInt8(RunTime): 72.23885718413639 us.
FfiMemory.PointerInt8TypedDataReuse(RunTime): 28.239710263614928 us.

- Constructing the TypedData for 1000 reads + 1000 writes takes ~20%
  of the total runtime, 400 reads or writes on TypedData, 160 reads
  or writes on Pointer.
FfiMemory.PointerInt8TypedDataNew(RunTime): 34.345480148372026 us.
FfiMemory.PointerInt8TypedDataReuse(RunTime): 28.239710263614928 us.

x64 AOT results:
FfiMemory.PointerInt8(RunTime): 13.862134213116345 us.
FfiMemory.PointerInt8TypedDataNew(RunTime): 26.149628021913365 us.
FfiMemory.PointerInt8TypedDataReuse(RunTime): 24.73322780505299 us.
- Using asTypedList is slower. (Some optimizations fail to kick in.)

Change-Id: I401edb88baf3a3c5094ecae808f122adf258da28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186289
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-02-23 12:41:49 +00:00
Clement Skau 9d03dd9378 [ffi/benchmark] Fix FfiCall branchmarks.
- Fixes expect logic in Float.. and Double.. benchmarks.
- Fixes expected values in the same benchmarks.
- Fixes typos in a few FFI function lookups.
- Adds expected value to 'Unexpected result' message.

Change-Id: I16eff1cac451412b376f56c070c5b8127ff744e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186284
Auto-Submit: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-02-23 08:41:39 +00:00
Daco Harkes a45276ab91 Reland "[vm/ffi] Roll package:ffi to Allocator and Opaque"
This can only be landed when `Allocator`, `Opaque`, and `AllocatorAlloc`
have rolled into Flutter/engine, that into Flutter/flutter, and into g3.

Deletes all the copies of `_CallocAllocator` and uses the one from
`package:ffi` instead.

Bug: https://github.com/dart-lang/sdk/issues/44622
Bug: https://github.com/dart-lang/sdk/issues/43974
Bug: https://github.com/dart-lang/sdk/issues/44621
Bug: https://github.com/dart-lang/sdk/issues/38721

Change-Id: I486034b379b5a63cad4aefd503ccd0f2ce5dd45e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180188
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-02-10 10:19:28 +00:00
Daco Harkes 3cfcc5a8e5 Revert "[vm/ffi] Roll package:ffi to Allocator and Opaque"
Revert submission 177862

Reason for revert: breaks g3 without https://github.com/flutter/engine/pull/23808
Reverted Changes:
I50b3b4c31:[vm/ffi] Roll `package:ffi` to `Allocator` and `Op...
I3f5b08c08:[vm/ffi] Change `Pointer<T extends Struct>.ref` to...
I6141c193b:[vm/ffi] Disallow empty structs

Change-Id: I128e7b096faea650e0ba0850a411eed3e97c00e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180185
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-01-20 21:37:11 +00:00
Daco Harkes 7d648e3ae7 [vm/ffi] Roll package:ffi to Allocator and Opaque
This can only be landed when `Allocator` and `Opaque` have rolled into
Flutter/engine, that into Flutter/flutter, and that into g3.
flutter/flutter/commit/a706cd211240f27be3b61f06d70f958c7a4156fe

Deletes all the copies of `_CallocAllocator` and uses the one from
`package:ffi` instead.

Issue: https://github.com/dart-lang/sdk/issues/44622
Issue: https://github.com/dart-lang/sdk/issues/43974
Issue: https://github.com/dart-lang/sdk/issues/44621
Issue: https://github.com/dart-lang/sdk/issues/38721

Change-Id: I50b3b4c31a2b839b35e3e057bd54f463b90bc55e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179540
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-01-20 18:08:25 +00:00
Daco Harkes ac805dff54 [vm/ffi] Migrate to empty Structs to Opaque
This CL migrates empty `Struct`s to `Opaque` native types.
It stops using `.ref` on `Pointer`s to these types.
And stops using `.ref` on `Pointer<Utf8>` which will be migrated in
`package:ffi`.

Issue: https://github.com/dart-lang/sdk/issues/44622
Issue: https://github.com/dart-lang/sdk/issues/43974

Change-Id: I3aa256af7d4ceaa8ee37b1b2ada71f870f43617b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179181
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-01-15 10:52:53 +00:00
Daco Harkes c36028b002 [vm/ffi] Migrate benchmarks/Ffi* to CallocAllocator
This CL does not yet roll `package:ffi` to use `Allocator`, because that
breaks the checked in Dart in Flutter in g3. Instead, this copies
`_CallocAllocator` from `package:ffi` into the benchmarks. (We need a
copy per benchmark such that file-copying before running benchmarks
works properly.) The copies can be deleted when we can update
`package:ffi` in the DEPS file to contain `_CallocAllocator`.

New API landed in: https://dart-review.googlesource.com/c/sdk/+/177705

Issue: https://github.com/dart-lang/sdk/issues/44621
Issue: https://github.com/dart-lang/sdk/issues/38721

Change-Id: I546de7ec65ceb6f05644a5f269b83f64656892e5
Cq-Include-Trybots: luci.dart.try:benchmark-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178995
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-01-14 12:35:58 +00:00
Stephen Adams d5335340f4 [benchmark] BigIntParsePrint: fix lints
Change-Id: Id0b131e9127b4b57bf88d376cb17d3b3676dfa6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177740
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-01-11 17:42:06 +00:00
Stephen Adams a5406428a5 Redo "[benchmark] Update BigIntParsePrint""
- Generate strings on one place rather than work hard to generate them
  the same with different number types.

- Update dart2 version


Change-Id: I69e6bde8b870598e062b5009578e5f8c7b2a6add
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176585
Auto-Submit: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-12-23 22:59:36 +00:00
Stephen Adams 11d51f4250 Revert "[benchmark] Update BigIntParsePrint"
This reverts commit 7ebbc89e78.

The benchmark became broken because it checks for round-trip fidelity
and using a shared list of strings there is rounding on the int.*.64
case.

I'll fix it and recommit.

TBR: whesse@google.com
Change-Id: I9ba25716992e59929726745b9414eb8dc17a55fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176580
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-12-17 18:19:24 +00:00
Stephen Adams 7ebbc89e78 [benchmark] Update BigIntParsePrint
- Generate strings on one place rather than work hard to generate them
  the same with different number types.

- Update dart2 version

Change-Id: I449d08a5ead13504ec604b11bd63b729590d6ffe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175861
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-12-17 06:32:33 +00:00
Stephen Adams 4bee6db9cf [benchmark] add int.parse benchmark
Change-Id: Ibded63c1d3fc60497bde8d19ee33e5e36edd0445
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175600
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2020-12-11 01:56:48 +00:00
Stephen Adams 68a57c59d7 [benchmarks] Omnibus benchmark
A benchmark that is a collection of other benchmarks.

This benchmark has two purposes:

 - As a medium sized compilation benchmark
 - As a tool for running benchmarks as part of a larger program

This benchmark is not intended to be run for the purpose of generating
benchmark timing results on Golem.

It should be extended over time to include most public benchmarks that
are meaningful on all Dart platforms.

Change-Id: I17f034cfd68d01ff5b4842b89b216fcea0d5bd3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170060
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2020-11-28 20:36:06 +00:00
Martin Kustermann c3ddc5c374 [vm/concurrency] Add EventLoopLatencyJson350KB bechmark
The existing EventLoopLatencyJson benchmark exercises the *worst case scenario*:
A background isolate is stressing the GC where the working memory set
does not fit into new space. This causes scavenges to copy the entire
newspace either into the to-space or promote it to old space.

The benchmark in this CL is similar to EventLoopLatencyJson, but it's working
memory set is significantly lower than new space, therefore not
exercising this worst case scenario (this represents the most common
scenario, which we would expect for compute() function in flutter)

(Due to difficulty sharing code between benchmarks, this CL adds
similar code as EventLoopLatencyJson)

Issue https://github.com/dart-lang/sdk/issues/36097

Change-Id: I385a620ba8900082f8ca5fb9080fc23d95112e83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169100
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-10-28 16:28:38 +00:00
Martin Kustermann c7085f211f [vm] Change EventLoopLatency benchmark to use RunTimeRaw latency
Change-Id: If1ec76839f5334d8a1e04a298b19a4211502fdeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168830
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2020-10-23 18:31:01 +00:00
Jonas Termansen 80621fed03 [benchmark] Add language version comments to benchmarks.
Change-Id: I44047a9d7907d166a6360397d0047ce9b835e5c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166854
Auto-Submit: Jonas Termansen <sortie@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
2020-10-13 01:43:22 +00:00
Martin Kustermann c4027afb95 [vm/concurrency] Remove unnecessary async marker in benchmark
Change-Id: Ida65d264d83147a85b4ac0c1b8ef3f157f4d3247
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162541
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-09-14 10:58:09 +00:00
Martin Kustermann 2935fecccb [vm/concurrency] Add EventLoopLatencyJson benchmarks
Issue https://github.com/dart-lang/sdk/issues/36097

Change-Id: Ic364e7dccc15bc14832ce61e45ba6c0e241dbbc3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162509
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-09-11 16:46:22 +00:00
Tess Strickland b02925a13f [benchmarks] Adding benchmarks for dynamic closure calls.
Bug: https://github.com/dart-lang/sdk/issues/40813
Change-Id: Ifdb7dfef4fc581c14cb570a534a64d73f5be9449
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160726
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2020-08-28 14:49:18 +00:00
Martin Kustermann 9be24ce946 [benchmark] Import MD5/SHA1/SHA256/SkeletalAnimation/SkeletalAnimationSIMD benchmarks from benchmarks-internal
Change-Id: I8b7a740091a438babfdd05dd81423b5593d3d7e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156020
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2020-08-24 14:37:28 +00:00
Benjamin Prosnitz d79ef922a5 Utf8 Encode Benchmarks
This CL adds Utf8 encode benchmarks to complement the existing Utf8
decode benchmarks. These benchmarks measure the time to process a
given input rune.

The motivation for adding this was after noticing in external
benchmarks that Dart utf8 encoding can sometimes be much slower
than the utf8 encoding in other languages. After adding benchmarks,
I plan to send CLs for some small tweaks that may improve performance.

Change-Id: I8751d7df22937e9a85b85794e3488c664c359bbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158820
Auto-Submit: Benjamin Prosnitz <bprosnitz@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2020-08-19 10:05:10 +00:00
Jonas Termansen b6a466c61e [benchmark] Fix lint in IsolateSpawn hello world.
Change-Id: I76495ccc6afecb141e7648b202ab46da0027b582
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157260
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-08-06 11:15:20 +00:00
Aske Simon Christensen bbcdc8dcff [benchmarks] Migrate Utf8Decode benchmark.
Change-Id: Idc5288c3df2e12e2a9d29c3102549531d46e4ff4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153081
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2020-07-01 16:53:11 +00:00
Alexander Markov 9ae1448ef0 [benchmarks] Add more test cases to ListCopy benchmarks.
This is the follow-up for the discussion on
https://dart-review.googlesource.com/c/sdk/+/152700

Change-Id: Ifeeafcdc312c4f7df7e0be1cc806b972b8c18078
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152709
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
2020-07-01 16:01:40 +00:00
Aske Simon Christensen d56c85f6f9 [benchmarks] Migrate RuntimeType benchmark.
Change-Id: I41e97ac2eb703ba3898bfa70ce8a60946d75ee70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153082
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2020-07-01 15:40:01 +00:00
Daco Harkes 585fa217a1 [benchmarks/ffi] Migrate benchmarks to NNBD
Change-Id: I36568f4f4d59c0a337aab82b6ca15d40495cb269
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152850
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2020-06-30 14:44:27 +00:00
Daco Harkes f0851772e9 [benchmarks/ffi] Fix lints
Change-Id: I37fe24f122ed9da269be658b9f98b957ddfcb7fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152848
Reviewed-by: Clement Skau <cskau@google.com>
2020-06-30 14:44:27 +00:00
Alexander Markov 8ef90b8641 [benchmarks] Remove expensive Iterable.cast from NNBD version of ListCopy benchmark
Dart 2 version of this benchmark doesn't have this call.
Dart 3 (NNBD) is more strict and allows implicit casts only if casting
from dynamic, so it highlights places where types are incompatible.

However, Iterable.cast<int>() has a high overhead and it doesn't look
like a right way to suppress static type check in this case, as it
creates a new Iterable which would additionally cast each element.
Simple 'input as dynamic' cast is enough in this case and reflects
what was happening in Dart 2 case when types are incompatible.

Fixes https://github.com/dart-lang/sdk/issues/42506

Change-Id: I8d83796a53b53e6f567f533f3d5369cd29f6ad97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152700
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2020-06-26 22:51:08 +00:00
Regis Crelier 63cf56d925 Roll benchmarks-internal to 02695da98bcf006b95630d3c386f4169d7ec4ecf
Ignore invariant_booleans lint rule when analyzing benchmarks.

Change-Id: I6071d3c1407e9c67689204e4ceb50cc1c0c8e109
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152598
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2020-06-26 01:56:03 +00:00
William Hesse 095deb888f Migrate ListCopy benchmark to null safety, clean up lints
Change-Id: Id7b8b64727e08ad1a5ab0bec7ad692ec64fa3848
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152329
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-25 15:28:54 +00:00
Jonas Termansen 912ae8230f [benchmark] Migrate Example benchmark to be null safe.
Analyzer lints are fixed while here.

TBR=whesse@google.com

Change-Id: I4e43d9b356608c5cb885f008fb232ea2390b9dd4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151840
Reviewed-by: William Hesse <whesse@google.com>
2020-06-23 08:41:19 +00:00
Martin Kustermann 177511aa17 [benchmarks] Disable literal_only_boolean_expressions/unnecessary_await_in_return analyzer hints
The literal_only_boolean_expressions analyzer hint flags this code:

   while (true) {
     ...
     if (cond) break;
     ...
   }

=> This is very common code.

The unnecessary_await_in_return analyzer hint flags this code:

    Future foo() async {
      ...
      return await foo();
    }

=> Addressing this hint by removing the `await` changes semantics,
performance characteristics and async stack traces.

Change-Id: I3c126123bfba7386b01033084e954267af21ba13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152001
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-06-23 06:02:07 +00:00
Martin Kustermann 0a6a4a24ba [benchmarks] Migrate Calls benchmark to NNBD
Mostly just satisfying new analyzer lints.

Change-Id: Ib3d0f5d216659fcbab6c6f5a3db6383dc965f73d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151523
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2020-06-23 05:41:57 +00:00
William Hesse 78617979b2 Migrate Isolate benchmarks to null safety
Change-Id: I420a60c58d9f727cf8d9cca99c211331ce8e3b57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151844
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-22 23:45:55 +00:00
Stephen Adams 5316f32a64 [benchmark] BigIntParsePrint: Hoist value in all loops
Hoist 'one' in all versions of benchmark for uniformity.

Change-Id: Id2aaa9b18903ff33e3057c01e13ff332fc8979ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151180
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2020-06-20 06:01:39 +00:00
Martin Kustermann a1416976c0 [benchmarks] Disable omit_local_variable_types analyzer hint
This hint flags code such as
   int time = watch.elapsedMillisecond;
and encourages using `var` everywhere:
   var time = watch.elapsedMillisecond;

Though if the type is not obvious to a developer, we should be allowed
to write it.

Furthermore it copies the rules from
`package:pedantic/analysis_options-1.9.0.yaml` to avoid being
automatically opted-in to new rules when a new package:pedantic
gets rolled into the SDK.

Change-Id: I45c72584885c608a56745685e9068ba83dfbed47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151526
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-06-19 13:43:23 +00:00
Daco Harkes d87046342f [benchmarks/ffi] Add FfiCall benchmark with Handles
On x64 desktop in JIT the trampolines with Handles are a bit slower
than trampolines passing integers or Pointers.

FfiCall.Uint64x01(RunTime): 200.8482627033541 us.
FfiCall.PointerUint8x01(RunTime): 261.3910088865656 us.
FfiCall.Handlex01(RunTime): 355.4978670458585 us.
FfiCall.Handlex02(RunTime): 384.86376755820663 us.
FfiCall.Handlex04(RunTime): 492.896007885658 us.
FfiCall.Handlex10(RunTime): 846.1214043993232 us.
FfiCall.Handlex20(RunTime): 1193.412291169451 us.

Issue: https://github.com/dart-lang/sdk/issues/36858
Issue: https://github.com/dart-lang/sdk/issues/41319

New issue for optimizing multiple handles:
https://github.com/dart-lang/sdk/issues/42341

Also cleans up dart2/native which was erroneously left over from the
benchmark duplication for NNBD.

Change-Id: I81223fefc47129d00984492efb9502d5449f0d4a
Cq-Include-Trybots: luci.dart.try:benchmark-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145593
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2020-06-15 13:27:16 +00:00