Commit Graph

220 Commits

Author SHA1 Message Date
Martin Kustermann 6e71aa8769 [dart2wasm] Move benchmarks/WasmJSInterop/{,dart/}WasmJSInterop.dart
This will put it into a place where the benchmarking system will find it.

Change-Id: I0ae3762ada89b4b4b71932eb565853a291935fcc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429300
Reviewed-by: Ömer Ağacan <omersa@google.com>
2025-05-19 03:50:29 -07:00
Robert Nystrom ff87171f6c Reformat benchmarks/ with 3.8 style.
Change-Id: Ied900f7d85addabc586823139aa78b879be035ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425182
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2025-04-29 07:46:46 -07:00
Ömer Ağacan 42e3a7a8fd [dart2wasm] Add more JS interop benchmarks
In prep for [1], benchmark `dartify` performance when converting JS call
return values to Dart values.

[1]: https://dart-review.googlesource.com/c/sdk/+/424021

Change-Id: I43549276f0ccdfefcc689c0574f82cad4a856aa5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424940
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-04-28 02:33:12 -07:00
Ömer Ağacan db448306dc [dart2wasm] Pass Dart double as f64 to JS interop
Don't convert Dart `double`s to `externref`s when calling JS interop
functions, pass them as `double`.

We pass other unboxed values (`int`s and `bool`s) as `externref`s, as
before:

- `int`s are most efficiently passed as `externref`s, as small integers
  can be converted to `i31ref` and externalized without allocation.

- `bool`s passed as `i32` mostly work because JS treats 0 as false and
  everything else as true, but the values can still be observed as
  numbers rather than bools, which causes some test failures.

Changes:

- Make raw interop procedures take `double` as argument, when the Dart
  type for the interop function argument is non-nullable `double`.

- Pass static type of the value and expected type (by the interop
  function) to `jsifyValue`.

- `jsifyValue` then takes the static type and expected type into account
  to avoid conversions when both are `double`s.

- `jsifyValue` is refactored to avoid the type conversion mapping
  allocation on every call.

New benchmark result before the changes:

    WasmJSInterop.call.void.1ArgsDouble(RunTimeRaw): 0.018275229357798167 ns.

After:

    WasmJSInterop.call.void.1ArgsDouble(RunTimeRaw): 0.014034965034965034 ns.

Issue: https://github.com/dart-lang/sdk/issues/60357
Change-Id: Ia70671f9a8e14f359f1119beda123e94aacdd2cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/422480
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2025-04-24 01:58:20 -07:00
Mayank Patke 2385d2fb11 [benchmarks] Remove Dart 2 benchmarks
Change-Id: I69d03bb874b015494c7af80ceffcc4482b3ec688
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421887
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2025-04-16 17:15:01 -07:00
Stephen Adams ed54a422c6 [js_interop] Add static js_interop benchmark
Benchmarks for type tests, type checks and simple calls.


dart2wasm (-O2) on d8:

```
JSInterop.isA.JSObject(RunTime): 3738.0 us.
JSInterop.isA.JSAny(RunTime): 17.59485924112607 us.
JSInterop.isA.JSString(RunTime): 189.23490199980102 us.
JSInterop.isA.JSArray(RunTime): 3734.0 us.
JSInterop.isA.Date(RunTime): 3798.0 us.
JSInterop.isA.JSUint8Array(RunTime): 3772.7272727272725 us.
JSInterop.calls.inline3ArgsSSS(RunTime): 339.57573748757045 us.
JSInterop.calls.inline3ArgsIII(RunTime): 723.5 us.
JSInterop.calls.hoisted3ArgsSSS(RunTime): 352.5 us.
JSInterop.calls.hoisted3ArgsIII(RunTime): 351.0 us.
JSInterop.calls.implicit3ArgsSSS(RunTime): 472.5 us.
JSInterop.calls.implicit3ArgsIII(RunTime): 727.5 us.
JSInterop.calls.inline7Args(RunTime): 374.7319165529343 us.
JSInterop.calls.moveJSObject(RunTime): 288.7436456063907 us.
JSInterop.calls.moveJSArray(RunTime): 291.53968945000724 us.
JSInterop.calls.moveJSUint8Array(RunTime): 307.1875476880818 us.
JSInterop.as.JSObject(RunTime): 49.69681970053211 us.
JSInterop.as.JSAny(RunTime): 49.746318524935035 us.
JSInterop.as.JSAnyQ(RunTime): 47.32810076608544 us.
JSInterop.as.JSNumber(RunTime): 52.525 us.
JSInterop.as.JSString(RunTime): 51.404529142432864 us.
JSInterop.as.JSUint8Array(RunTime): 52.16644783355217 us.
JSInterop.as.T.JSObject(RunTime): 49.38895061104939 us.
JSInterop.as.T.JSAny(RunTime): 48.12708558537388 us.
JSInterop.as.T.JSAnyQ(RunTime): 47.56761945904433 us.
JSInterop.as.T.JSNumber(RunTime): 47.657094515204214 us.
JSInterop.as.T.JSString(RunTime): 47.48517564790097 us.
JSInterop.as.T.JSUint8Array(RunTime): 47.70409362222118 us.
```

dart2js (-O2) on d8:

```
JSInterop.isA.JSObject(RunTime): 1773.6131934032983 us.
JSInterop.isA.JSAny(RunTime): 12.625357640133245 us.
JSInterop.isA.JSString(RunTime): 18.38 us.
JSInterop.isA.JSArray(RunTime): 1907.7961019490256 us.
JSInterop.isA.Date(RunTime): 1807.3333333333333 us.
JSInterop.isA.JSUint8Array(RunTime): 1896 us.
JSInterop.calls.inline3ArgsSSS(RunTime): 39.2 us.
JSInterop.calls.inline3ArgsIII(RunTime): 40.1 us.
JSInterop.calls.hoisted3ArgsSSS(RunTime): 46.50691866351671 us.
JSInterop.calls.hoisted3ArgsIII(RunTime): 43.89473503510549 us.
JSInterop.calls.implicit3ArgsSSS(RunTime): 39.31127274145428 us.
JSInterop.calls.implicit3ArgsIII(RunTime): 40.094769455075635 us.
JSInterop.calls.inline7Args(RunTime): 55.24056374534262 us.
JSInterop.calls.moveJSObject(RunTime): 2042 us.
JSInterop.calls.moveJSArray(RunTime): 230.518018018018 us.
JSInterop.calls.moveJSUint8Array(RunTime): 441.555604107494 us.
JSInterop.as.JSObject(RunTime): 2007 us.
JSInterop.as.JSAny(RunTime): 17.560859513123894 us.
JSInterop.as.JSAnyQ(RunTime): 15.374923125384374 us.
JSInterop.as.JSNumber(RunTime): 16.39636882904937 us.
JSInterop.as.JSString(RunTime): 19.88 us.
JSInterop.as.JSUint8Array(RunTime): 433 us.
JSInterop.as.T.JSObject(RunTime): 2127 us.
JSInterop.as.T.JSAny(RunTime): 71.61969628522779 us.
JSInterop.as.T.JSAnyQ(RunTime): 71.5853171964357 us.
JSInterop.as.T.JSNumber(RunTime): 68.74619392381081 us.
JSInterop.as.T.JSString(RunTime): 77.84709574921533 us.
JSInterop.as.T.JSUint8Array(RunTime): 471.5 us.
```

Change-Id: Ie623ede8ce46ae6bbf8e2e653b1c5916c31442db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/422021
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2025-04-11 16:06:50 -07:00
Daco Harkes 0768228750 [ffi] Format samples and benchmarks with Dart 3.8
Change-Id: I4f8e695ac648becc0de3466b6ba2058cbae7c408
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/422103
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2025-04-11 07:53:45 -07:00
Ömer Ağacan 6952a80978 [dart2wasm] JS interop: pass small ints as i31ref
In V8, the only way to pass a Wasm integer or float to JS without
allocation is by passing it as a 31-bit integer.

This can be done by:

1. Passing as `i32`. If the integer fits into 31 bits it's passed
   without allocation.

2. Passing as externalized `i31ref`.

(1) requires importing the JS function with different signatures: for
each `int` argument we would need a signature with the `i32` as the Wasm
argument type, and another with `externref` (or `f64` if we want to pass
large integers as `f64`).

This is not feasible as with a JS function with N `int` arguments we
would need `2^N` imports. So we implement (2): we import each interop
function with one signature, passing `externref` as the argument, as
before. When the number fits into 31 bits we convert it to an `i31ref`
and externalize it. Otherwise we convert the number to `externref` as
before, by calling the JS function `(o) => o` imported with type `[f64]
-> [externref]`.

New benchmark checks `int` passing for small (31 bit) and large (larger
than 31 bit) integers. Results before:

    WasmJSInterop.call.void.1ArgsSmi(RunTimeRaw): 0.020 ns.
    WasmJSInterop.call.void.1ArgsInt(RunTimeRaw): 0.018 ns.

After:

    WasmJSInterop.call.void.1ArgsSmi(RunTimeRaw): 0.014 ns.
    WasmJSInterop.call.void.1ArgsInt(RunTimeRaw): 0.018 ns.

Issue: https://github.com/dart-lang/sdk/issues/60357
Change-Id: I749001e0e7e9784114415439298c2f3e0fb974b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419880
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-04-11 04:14:04 -07:00
Daco Harkes 35c0ef8410 [ffi] Remove deprecated Pointer.elementAt uses
Change-Id: I8ab032442db58f41e474ecfdeace4ff65953c8ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421186
Reviewed-by: Hossein Yousefi <yousefi@google.com>
2025-04-10 11:14:02 -07:00
Mayank Patke 3a3dfcbb7d [dart2js] Remove references to new-rti/old-rti.
The "new" rti library has been standard for years now and no one should
be passing `--experiment-new-rti` or `--use-old-rti`. We can now clean
up any references to different versions of rtis.

Change-Id: I4421b8943fe5034ed4d259477e8112b25ba0c763
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416326
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2025-03-19 11:54:57 -07:00
Mo Luo 078ddac8a7 Rename variable millisecondsPerExercise to microsecondsPerExercise
Closes https://github.com/dart-lang/sdk/pull/60286

GitOrigin-RevId: 051278201d6f0c7f362e618b51a4a493cec8929f
Change-Id: Icd98294879478b754809b45a938591e07d64543a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414480
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2025-03-10 03:17:30 -07:00
Devon Carew 1039490228 [deps] bring in dart-lang/i18n; update intl benchmark and sdk usage
Change-Id: Ic0b7558fb7caf3f8d8ac9a1f460345de45d563f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410080
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Moritz Sümmermann <mosum@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2025-02-18 08:03:22 -08:00
Devon Carew 71ad03fa34 [benchmarks] contribute a package:intl benchmark
Change-Id: I9ce75ad7ba1599e4bd6311e0ae0397005d46fe86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409762
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2025-02-13 13:53:57 -08:00
Stephen Adams 4a62cface0 [benchmarks] Queue add/remove benchmark
Change-Id: I98ba55744c86ed3e39d0087f4fcb83e4a2a63f68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408240
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2025-02-12 13:32:16 -08:00
Daco Harkes 6157f4598c [benchmark][ffi] Add simple callback benchmark
A basic benchmark for FFI callbacks. I'm currently not planning on
extending it to cover more calling conventions or running it on our
benchmark infra. We can leave that for when we want to do it.

Bug: https://github.com/dart-lang/sdk/issues/38171
Change-Id: I0c5fec81333e9a8da092b4f51ceb9f80a2eb2cf7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407020
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2025-02-04 03:36:29 -08:00
Stephen Adams d2c9d936a7 [benchmarks] Add MultipleReturns to Omnibus
Change-Id: I891fcca4295e244982aae470cb19473ae1349483
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396160
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-11-18 22:02:17 +00:00
Robert Nystrom e4c8b49dcc Format benchmarks/.
Change-Id: I1362ada67a02b0ed352612fc29c727e94d8cd254
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394901
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2024-11-18 10:06:01 +00:00
asiva 8b2b6b2440 Reland ""[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory""
This reverts commit 74c5aa3a7a.

Reason for revert: Fix golem breakage by not changing the script dart_precompiled_runtime2

TEST=ci

Original change's description:
> Revert ""[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory""
>
> This reverts commit f81a402aa1.
>
> Reason for revert: golem benchmarks are failing to run
>
> TEST=ci
>
> Original change's description:
> > "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
> >
> > Fixed golem breakage by temporarily copying dartaotruntime to dart_precompiled_runtime
> >
> > This reverts commit 75e6a748f7.
> >
> > TEST=ci
> >

Change-Id: I9efe40643c59bc617f6fb484b89b038deaffbb93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393941
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2024-11-08 04:36:23 +00:00
Siva Annamalai 74c5aa3a7a Revert ""[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory""
This reverts commit f81a402aa1.

Reason for revert: golem benchmarks are failing to run

TEST=ci

Original change's description:
> "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
>
> Fixed golem breakage by temporarily copying dartaotruntime to dart_precompiled_runtime
>
> This reverts commit 75e6a748f7.
>
> TEST=ci
>
> Original change's description:
> > Revert "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
> >
> > This reverts commit 1b331d05c2.
> >
> > Reason for revert: golem builds are failing
> >
> > Original change's description:
> > > [SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory
> > >
> > > TEST=ci
> > >
>
> Change-Id: Id0f383eabb496c06c0acebc639c8e3b056ba82d0
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393781
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

Change-Id: Iec494940412aa31dbefdc5280e35ae99e8cecb26
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393764
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2024-11-06 05:37:46 +00:00
asiva f81a402aa1 "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
Fixed golem breakage by temporarily copying dartaotruntime to dart_precompiled_runtime

This reverts commit 75e6a748f7.

TEST=ci

Original change's description:
> Revert "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
>
> This reverts commit 1b331d05c2.
>
> Reason for revert: golem builds are failing
>
> Original change's description:
> > [SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory
> >
> > TEST=ci
> >

Change-Id: Id0f383eabb496c06c0acebc639c8e3b056ba82d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393781
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-11-06 03:10:31 +00:00
Siva Annamalai 75e6a748f7 Revert "[SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory"
This reverts commit 1b331d05c2.

Reason for revert: golem builds are failing

Original change's description:
> [SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory
>
> TEST=ci
>
> Change-Id: I96ed52994e0d955300c18026032e68003504666d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389760
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>

Change-Id: I5dc14973f4ee4e577b2c996839d5e497c97fb440
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393761
Commit-Queue: Siva Annamalai <asiva@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-11-05 21:58:09 +00:00
asiva 1b331d05c2 [SDK/VM] - Rename dart_precompiled_runtime to dartaotruntime, ensures we have a uniform name for the executable between the build directories and the SDK directory
TEST=ci

Change-Id: I96ed52994e0d955300c18026032e68003504666d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389760
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2024-11-05 20:39:15 +00:00
Parker Lougheed ffc82e6f17 Stop enabling the package_api_docs lint
The lint is non-functional and will be deprecated soon.

Bug: https://github.com/dart-lang/linter/issues/5107
Change-Id: I4d4b75a6c7978f584bef37351514391f55761c55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389594
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
2024-10-14 21:22:19 +00:00
Stephen Adams 5b4c1bcf81 [benchmarks] Add SwitchFSM and UiMatrix to Omnibus
Change-Id: I2b5712bda7fe48bc7d4566a4a54ebe39a92214a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381747
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2024-09-04 17:37:49 +00:00
Ömer Sinan Ağacan 01cf48f653 [benchmarks] Remove dynamic invocations in BigIntParsePrint benchmark
The dynamic invocations `sink1.codeUnits` and `sink2.isEven` can be slow
on dart2wasm.

They are done once in a few iterations, but the noise can still be
eliminated with a `if (runtimeFalse)` guard around the code that makes
sure the benchmarked code won't be optimized away.

Change-Id: Id85013fa4be1912d1c710cd119e9f6f1e77bcff4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373040
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-06-26 08:07:11 +00:00
Martin Kustermann ad6122810a [dart2wasm] Use RunTimeRaw for metric printer in WasmDataTransfer benchmark
Golem config expects RunTimeRaw metric (as we want to see not runs per
second but a more meaningful benchmark, i.e. how much transferring 1KB
of data takes)

=> Golem cannot just display it in different form, we have to make the
    benchmark report it also as RunTimeRaw.
=> This CL should fix the golem benchmarks.

Change-Id: I91301930941986771eb0725fd0d85424bb07dc3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372640
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-06-21 07:55:16 +00:00
Martin Kustermann 4908814f3a [dart2wasm] Add WasmDataTransfer.* benchmark
Change-Id: I4f7c68cf075081be2643ea8e047af7f02d0c3157
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372423
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-06-20 11:14:16 +00:00
Srujan Gaddam 7ec9514093 [benchmarks] Add Function.toJS benchmark
Adds a benchmark to test converting Dart functions to and
from JS as well as calling them.

Specifically, tests some combinations of the following:
- Converting vs calling functions
- JS vs Dart functions
- Calling instance methods vs static methods vs closure vs
  closures stored in fields

Change-Id: I8f5b63781201042c4068437fe84c3043d6dfb446
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368064
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2024-06-14 19:42:10 +00:00
William Hesse 1f80809e0d Roll benchmark_harness to version 2.3.0, add new benchmark.
This relands "Add copy of ObjectHash benchmark that uses hardware performance counters"

It lands a roll of benchmark_harness to a new version without
the breaking change in the previous, reverted, roll.
It adds a copy of a benchmark that uses
the new features in benchmark_harness.

Reason for reland: The breaking change is removed from benchmark harness.

Original change's description:
> Revert "Add copy of ObjectHash benchmark that uses hardware performance counters"
>
> This reverts commit faee649175.
>
> Reason for revert: The new version of benchmark_harness breaks cbuild.
>
> Original change's description:
> > Add copy of ObjectHash benchmark that uses hardware performance counters
> >
> > Bug: b/320440992
> > Change-Id: Ia504a59861b2de32c0b82d6bb38491600a37e9ff
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363703
> > Reviewed-by: Jonas Termansen <sortie@google.com>
>
> Bug: b/320440992
> Change-Id: I19bd814c1641243ab0b75f45bc55cdfe27d4bff3
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363740
> Auto-Submit: Alexander Thomas <athom@google.com>
> Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
> Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
> Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>

Bug: b/320440992
Change-Id: I101a7ca756a5da5ddf934818325177501c370f23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364180
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: William Hesse <whesse@google.com>
2024-04-23 15:19:49 +00:00
Alexander Thomas 6250303b38 Revert "Add copy of ObjectHash benchmark that uses hardware performance counters"
This reverts commit faee649175.

Reason for revert: The new version of benchmark_harness breaks cbuild.

Original change's description:
> Add copy of ObjectHash benchmark that uses hardware performance counters
>
> Bug: b/320440992
> Change-Id: Ia504a59861b2de32c0b82d6bb38491600a37e9ff
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363703
> Reviewed-by: Jonas Termansen <sortie@google.com>

Bug: b/320440992
Change-Id: I19bd814c1641243ab0b75f45bc55cdfe27d4bff3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363740
Auto-Submit: Alexander Thomas <athom@google.com>
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
2024-04-19 14:37:38 +00:00
William Hesse faee649175 Add copy of ObjectHash benchmark that uses hardware performance counters
Bug: b/320440992
Change-Id: Ia504a59861b2de32c0b82d6bb38491600a37e9ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363703
Reviewed-by: Jonas Termansen <sortie@google.com>
2024-04-19 13:02:55 +00:00
William Hesse 36be5e7318 Avoid lint warning in TearOff benchmark
The throw_in_finally lint rule, which prohibits use of throw
in finally blocks, is enabled in benchmarks/analysis_options.yaml.

This change removes violations of this lint, so IDEs don't show
problems with this file when analyzing the SDK.

Bug: https://github.com/dart-lang/sdk/issues/54808
Change-Id: Idace8fb88ac26b86c2abd73787aafdee6f188af1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360720
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: William Hesse <whesse@google.com>
2024-04-09 14:40:23 +00:00
Jonas Termansen b6aa2976dc [benchmarks] Fix benchmarks warming up incorrectly.
The benchmarks were using a range of antipatterns that did not do what
the authors thought they did. It seems that the authors thought the
warmup method has to run for a while and do the full warmup, but the
truth is that the harness will do that for you by running the warmup
function in a timed loop. Instead these patterns just wasted time by
making the warmup more expensive and complex than needed.

This change just removes the warmup overrides since none of them do
anything positive. This change prepares us for future improvements to
the benchmark harness.

Fixes: b/324874055
Change-Id: Ib7c282123a2151614bc95a105a30e67221f11315
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352022
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2024-02-22 14:38:19 +00:00
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
Alexander Markov e7eb0aaa20 [benchmarks] Add benchmark for taking tear-offs repeatedly
Issue: https://github.com/dart-lang/sdk/issues/54808
Change-Id: Ice28033bab71e30f9a586564d7e55d9c4f5ce770
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350640
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-02-07 15:16:19 +00:00
Oleh Prypin 5a1ef6089c Revert "[ffi]: Remove pointer elementAt method."
This reverts commit f706ff4ee2.

Reason for revert: b/321667799 - package:win32 uses this method - https://github.com/dart-windows/win32/blob/a78ff108fbf54927b0334c1bab8f15526c24cbf8/lib/src/com/iapplicationactivationmanager.dart#L46

Original change's description:
> [ffi]: Remove pointer elementAt method.
>
> Closes #54250
>
> TEST=test/ffi
>
> R=dacoharkes@google.com
> Change-Id: I0e88adfcfe3caef0ad3bb6814ad8f27dce5dc7f4
> CoreLibraryReviewExempt: FFI only
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346380
> Reviewed-by: Daco Harkes <dacoharkes@google.com>
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Auto-Submit: Shikhar <shikharish05@gmail.com>

Change-Id: I1b7a48d14e9b85676a27f76a926e21cac9c76c85
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347600
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-01-22 12:20:48 +00:00
Shikhar Soni f706ff4ee2 [ffi]: Remove pointer elementAt method.
Closes #54250

TEST=test/ffi

R=dacoharkes@google.com
Change-Id: I0e88adfcfe3caef0ad3bb6814ad8f27dce5dc7f4
CoreLibraryReviewExempt: FFI only
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346380
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Shikhar <shikharish05@gmail.com>
2024-01-22 11:34:18 +00:00
Stephen Adams 4a25eae660 [benchmark] Utf8Decode chunked and polymorphic benchmark
This benckmark complements the existing `Utf8Decode` benchmarks by exploring different scenarios. There are three axes of variation - input complexity, conversion type, and polymorphism.


Change-Id: I06706e8efd1b254d65c7abee9f29e6d0b10923ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335504
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-11-15 18:21:23 +00:00
Sam Rawlins 93541c708c linter: Remove two deprecated linter rules
Fixes https://github.com/dart-lang/linter/issues/4800

Change-Id: I4eef17ca19ea7469fba372c28eef7618249c48dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334080
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-11-09 17:03:15 +00:00
Jacob Richman 933537b66b Trivial cleanup to make VSCode workspace for the SDK
free of diagnostics as long as you filter with "!TODO"

R=athom@google.com, jensj@google.com, natebiggs@google.com

Change-Id: I73cf3c5ef6dab81808330c4eb5f44cb62e753c81
Tested: manually verified that VSCode is warning free. No changes in functionality.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333903
Auto-Submit: Jacob Richman <jacobr@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Jacob Richman <jacobr@google.com>
2023-11-07 17:49:53 +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
Jonas Termansen c349f992a6 [benchmark] Rename dds to dds_aot in SDKArtifactSizes.
Bug: b/298173463
Change-Id: Ia9d1672e2561e6b35ed5d3c88f8704628857ce7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/328480
Commit-Queue: William Hesse <whesse@google.com>
Auto-Submit: Jonas Termansen <sortie@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2023-10-27 12:23:23 +00:00
Alexander Aprelev 05274b2592 [benchmark] Add benchmark prefix to UiMatrix benchmark.
Change-Id: I208a06355a233ff1c07c9be494cc2676d8d485ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326685
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-09-18 22:41:23 +00:00
Alexander Aprelev bc5008a023 [benchmark] Add uimatrix benchmark.
https://github.com/yjbanov/uimatrix is WIP, but already proved useful to highlight areas for some performance improvement.

Change-Id: I8f86163e91e276ee4195b7d5c635ffbf3dbaa075
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325320
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2023-09-13 15:27:37 +00:00
William Hesse 69d5249e7f [benchmarks] Publish some more Dart benchmarks
Publish some TypedData and ForLoop benchmarks to the Dart sdk repo.
The benchmarks, authored by the Dart project, were previously
in the benchmark-internal repository.

Bug: b/298617448
Change-Id: I3327553ac5feca51a2f978e7d9b9c96fac2af121
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323840
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2023-09-04 15:57:53 +00:00
Martin Kustermann 4d4a922638 [benchmarks] Remove unnecessary utf8.encode() as Uint8List downcast
The return type of `utf8.encode()` was made more precise in [0] (from
`List<int>` to `Uint8List`)

[0] https://dart-review.googlesource.com/c/sdk/+/254903

TEST=ci

Change-Id: I3e578ac8dc5f3f66396cb374e3dcadd989919518
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321860
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-08-21 08:21:37 +00:00
Tess Strickland 4af0a59e8c [benchmarks] Change the MemoryCopy memcpy benchmarks to use memmove.
While our benchmarks don't involve overlapping memory between source
and destination, general methods for copying between TypedData must.
Thus, our benchmark for using the C interface via FFI must use memmove
instead of memcpy.

To avoid having to update our benchmark configurations, the name of
that benchmark is unchanged.

In addition, this CL adds filtering for benchmark names and turning on
and off specific outputs for quick comparisons when running manually.

Change-Id: I20616549d8bc9ab481884846d3f13df20a3c854e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319981
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-08-11 13:17:17 +00:00
Tess Strickland 7f943ea210 [benchmarks] Fix MemoryCopy when elapsed time is too small.
Otherwise, we might get +Inf which will then fail on the conversion
to an integer in ceil().

Change-Id: Ibba49257e6801894f1e7724aa7a998ba579f7be3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319520
Auto-Submit: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-08-09 15:28:55 +00:00
Tess Strickland d984fd77f6 [benchmarks] Add MemoryCopy benchmark suite.
The MemoryCopy benchmark suite measures the overhead of copying
data between compatible TypedData or Pointer values.

Change-Id: Iaf5ea27b7f9177f4800880da36234afd2b908db2
Bug: https://github.com/dart-lang/sdk/issues/42072
Bug: b/294114694
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318661
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2023-08-09 13:28:44 +00:00
Tess Strickland 51ae7c7b9d [benchmarks] Add verbose flag to FfiStructCopy benchmark suite.
Change-Id: I28ab6c85db3705224a59f80ea3c13a78a141c851
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318923
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2023-08-08 11:59:29 +00:00