Commit 273ae87
[dart2wasm] JS interop: use dartify functions specific to types being converted
`dartifyRaw` converts based on the runtime type and it's slow. Use
dartify functions specific to the expected Dart types when converting JS
values to Dart.
Benchmarks before:
WasmJSInterop.call.bool.0Args(RunTimeRaw): 0.023022675490940652 ns.
WasmJSInterop.call.nullableBool.0Args(RunTimeRaw): 0.02189111747851003 ns.
WasmJSInterop.call.num.0Args(RunTimeRaw): 0.028148974752406197 ns.
WasmJSInterop.call.nullableNum.0Args(RunTimeRaw): 0.028181565023670287 ns.
WasmJSInterop.call.double.0Args(RunTimeRaw): 0.022986874778290176 ns.
WasmJSInterop.call.nullableDouble.0Args(RunTimeRaw): 0.02907384054925038 ns.
WasmJSInterop.call.int.0Args(RunTimeRaw): 0.029822888283378746 ns.
WasmJSInterop.call.nullableInt.0Args(RunTimeRaw): 0.029088963619688168 ns.
WasmJSInterop.call.string.0Args(RunTimeRaw): 0.020517746991606835 ns.
WasmJSInterop.call.nullableString.0Args(RunTimeRaw): 0.02004299314157027 ns.
WasmJSInterop.call.JSArray.0Args(RunTimeRaw): 0.020724174653887113 ns.
WasmJSInterop.call.nullableJSArray.0Args(RunTimeRaw): 0.020034212115113702 ns.
WasmJSInterop.call.JSUint8Array.0Args(RunTimeRaw): 0.030711090544501003 ns.
WasmJSInterop.call.nullableJSUint8Array.0Args(RunTimeRaw): 0.030679086538461537 ns.
Benchmarks after:
WasmJSInterop.call.bool.0Args(RunTimeRaw): 0.019944312674022892 ns.
WasmJSInterop.call.nullableBool.0Args(RunTimeRaw): 0.0206124732933157 ns.
WasmJSInterop.call.num.0Args(RunTimeRaw): 0.024475179056557175 ns.
WasmJSInterop.call.nullableNum.0Args(RunTimeRaw): 0.02481147236988503 ns.
WasmJSInterop.call.double.0Args(RunTimeRaw): 0.01829122645842903 ns.
WasmJSInterop.call.nullableDouble.0Args(RunTimeRaw): 0.024581756014165346 ns.
WasmJSInterop.call.int.0Args(RunTimeRaw): 0.01788861473387381 ns.
WasmJSInterop.call.nullableInt.0Args(RunTimeRaw): 0.02333933933933934 ns.
WasmJSInterop.call.string.0Args(RunTimeRaw): 0.018238532110091743 ns.
WasmJSInterop.call.nullableString.0Args(RunTimeRaw): 0.019454117647058823 ns.
WasmJSInterop.call.JSArray.0Args(RunTimeRaw): 0.020055434567412395 ns.
WasmJSInterop.call.nullableJSArray.0Args(RunTimeRaw): 0.019759825327510916 ns.
WasmJSInterop.call.JSUint8Array.0Args(RunTimeRaw): 0.030023959269242288 ns.
WasmJSInterop.call.nullableJSUint8Array.0Args(RunTimeRaw): 0.03057233704292528 ns.
JSValue wrapper type performance (`JSUint8Array`, `JSArray`) does not
change as we had a special case (before this CL) for those types and
directly boxed them.
Issue: #60357
Change-Id: I0ee8e49cf3ed801634e4c6e13b1c597b2e730d59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424021
Commit-Queue: Ömer Ağacan <[email protected]>
Reviewed-by: Martin Kustermann <[email protected]>1 parent bbb847e commit 273ae87
File tree
4 files changed
+118
-18
lines changed- pkg/dart2wasm/lib
- js
- sdk/lib/_internal/wasm/lib
4 files changed
+118
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
97 | | - | |
| 99 | + | |
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
| |||
127 | 129 | | |
128 | 130 | | |
129 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
130 | 170 | | |
131 | 171 | | |
132 | 172 | | |
| |||
272 | 312 | | |
273 | 313 | | |
274 | 314 | | |
275 | | - | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
276 | 320 | | |
277 | 321 | | |
278 | 322 | | |
| |||
322 | 366 | | |
323 | 367 | | |
324 | 368 | | |
325 | | - | |
| 369 | + | |
326 | 370 | | |
327 | | - | |
| 371 | + | |
328 | 372 | | |
329 | | - | |
| 373 | + | |
330 | 374 | | |
331 | 375 | | |
332 | 376 | | |
| |||
336 | 380 | | |
337 | 381 | | |
338 | 382 | | |
339 | | - | |
| 383 | + | |
340 | 384 | | |
341 | 385 | | |
342 | 386 | | |
343 | 387 | | |
344 | 388 | | |
345 | 389 | | |
346 | | - | |
| 390 | + | |
347 | 391 | | |
348 | 392 | | |
349 | 393 | | |
350 | | - | |
| 394 | + | |
351 | 395 | | |
352 | 396 | | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
360 | 419 | | |
361 | 420 | | |
362 | 421 | | |
| |||
419 | 478 | | |
420 | 479 | | |
421 | 480 | | |
422 | | - | |
| 481 | + | |
423 | 482 | | |
424 | 483 | | |
425 | 484 | | |
| |||
430 | 489 | | |
431 | 490 | | |
432 | 491 | | |
433 | | - | |
| 492 | + | |
434 | 493 | | |
435 | 494 | | |
436 | 495 | | |
| |||
442 | 501 | | |
443 | 502 | | |
444 | 503 | | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
445 | 519 | | |
446 | 520 | | |
447 | 521 | | |
| |||
467 | 541 | | |
468 | 542 | | |
469 | 543 | | |
470 | | - | |
| 544 | + | |
471 | 545 | | |
472 | 546 | | |
473 | 547 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
164 | 171 | | |
165 | 172 | | |
166 | 173 | | |
| |||
176 | 183 | | |
177 | 184 | | |
178 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
179 | 189 | | |
180 | 190 | | |
181 | 191 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
| |||
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
| 169 | + | |
168 | 170 | | |
169 | 171 | | |
170 | 172 | | |
| |||
529 | 531 | | |
530 | 532 | | |
531 | 533 | | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
532 | 546 | | |
533 | 547 | | |
534 | 548 | | |
| |||
603 | 617 | | |
604 | 618 | | |
605 | 619 | | |
| 620 | + | |
606 | 621 | | |
607 | 622 | | |
608 | 623 | | |
| |||
0 commit comments