Commit c6362da
[dart2wasm] Convert UTF-8 chunks to U8List before decoding
Currently `convertSingle` converts the input to `U8List`, but
`convertChunked` works on `Uint8List`. This makes functions common in
both (`decode8`, `decode16`) polymorphic in input.
Update `convertChunked` to also convert the input to `U8List`. With this
`decode8` and `decode16` becomes monomorphic in the input type. Also
update array accesses in these methods to avoid bounds checks.
Check for a few fast cases in `List<int>` to `U8List` copying. If the
list is a `WasmI8ArrayBase` (used in typed data) or `WasmListBase` (used
in lists), we avoid polymorphism, indirections, and bounds checks during
copying.
Golem reports up to 600% improvement in some chunked parsing micro-
benchmarks.
Change-Id: Iddf6dae1a5d77cf574be77313dff779b4715e283
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395980
Commit-Queue: Ömer Ağacan <[email protected]>
Reviewed-by: Slava Egorov <[email protected]>1 parent c5b5090 commit c6362da
File tree
3 files changed
+178
-35
lines changed- sdk/lib/_internal/wasm/lib
- tests/lib/convert
3 files changed
+178
-35
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
1987 | 1988 | | |
1988 | 1989 | | |
1989 | 1990 | | |
1990 | | - | |
| 1991 | + | |
1991 | 1992 | | |
1992 | 1993 | | |
1993 | 1994 | | |
1994 | | - | |
| 1995 | + | |
1995 | 1996 | | |
1996 | 1997 | | |
1997 | 1998 | | |
| |||
2104 | 2105 | | |
2105 | 2106 | | |
2106 | 2107 | | |
2107 | | - | |
2108 | | - | |
| 2108 | + | |
2109 | 2109 | | |
2110 | | - | |
2111 | | - | |
| 2110 | + | |
| 2111 | + | |
2112 | 2112 | | |
2113 | 2113 | | |
2114 | | - | |
| 2114 | + | |
2115 | 2115 | | |
2116 | 2116 | | |
2117 | 2117 | | |
| |||
2205 | 2205 | | |
2206 | 2206 | | |
2207 | 2207 | | |
2208 | | - | |
| 2208 | + | |
2209 | 2209 | | |
2210 | | - | |
2211 | | - | |
2212 | | - | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
2213 | 2213 | | |
2214 | 2214 | | |
2215 | 2215 | | |
2216 | 2216 | | |
2217 | 2217 | | |
2218 | | - | |
| 2218 | + | |
2219 | 2219 | | |
2220 | 2220 | | |
2221 | 2221 | | |
| |||
2229 | 2229 | | |
2230 | 2230 | | |
2231 | 2231 | | |
2232 | | - | |
| 2232 | + | |
2233 | 2233 | | |
2234 | 2234 | | |
2235 | 2235 | | |
| |||
2241 | 2241 | | |
2242 | 2242 | | |
2243 | 2243 | | |
2244 | | - | |
| 2244 | + | |
2245 | 2245 | | |
2246 | 2246 | | |
2247 | 2247 | | |
2248 | 2248 | | |
2249 | 2249 | | |
2250 | 2250 | | |
2251 | 2251 | | |
2252 | | - | |
| 2252 | + | |
2253 | 2253 | | |
2254 | 2254 | | |
2255 | 2255 | | |
| |||
2260 | 2260 | | |
2261 | 2261 | | |
2262 | 2262 | | |
2263 | | - | |
| 2263 | + | |
2264 | 2264 | | |
2265 | 2265 | | |
2266 | 2266 | | |
| |||
2273 | 2273 | | |
2274 | 2274 | | |
2275 | 2275 | | |
2276 | | - | |
| 2276 | + | |
2277 | 2277 | | |
2278 | 2278 | | |
2279 | 2279 | | |
| |||
2293 | 2293 | | |
2294 | 2294 | | |
2295 | 2295 | | |
2296 | | - | |
| 2296 | + | |
2297 | 2297 | | |
2298 | 2298 | | |
2299 | 2299 | | |
| |||
2309 | 2309 | | |
2310 | 2310 | | |
2311 | 2311 | | |
2312 | | - | |
| 2312 | + | |
2313 | 2313 | | |
2314 | 2314 | | |
2315 | 2315 | | |
| |||
2320 | 2320 | | |
2321 | 2321 | | |
2322 | 2322 | | |
2323 | | - | |
| 2323 | + | |
2324 | 2324 | | |
2325 | 2325 | | |
2326 | 2326 | | |
| |||
2369 | 2369 | | |
2370 | 2370 | | |
2371 | 2371 | | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | |
| 2377 | + | |
| 2378 | + | |
| 2379 | + | |
| 2380 | + | |
| 2381 | + | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
| 2400 | + | |
| 2401 | + | |
| 2402 | + | |
| 2403 | + | |
| 2404 | + | |
| 2405 | + | |
| 2406 | + | |
| 2407 | + | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1976 | 1976 | | |
1977 | 1977 | | |
1978 | 1978 | | |
1979 | | - | |
1980 | | - | |
| 1979 | + | |
| 1980 | + | |
1981 | 1981 | | |
1982 | 1982 | | |
1983 | 1983 | | |
| |||
2565 | 2565 | | |
2566 | 2566 | | |
2567 | 2567 | | |
2568 | | - | |
| 2568 | + | |
2569 | 2569 | | |
2570 | 2570 | | |
2571 | 2571 | | |
2572 | 2572 | | |
2573 | | - | |
| 2573 | + | |
2574 | 2574 | | |
2575 | 2575 | | |
2576 | 2576 | | |
2577 | | - | |
| 2577 | + | |
2578 | 2578 | | |
2579 | 2579 | | |
2580 | 2580 | | |
| |||
2679 | 2679 | | |
2680 | 2680 | | |
2681 | 2681 | | |
2682 | | - | |
| 2682 | + | |
2683 | 2683 | | |
2684 | 2684 | | |
2685 | 2685 | | |
| |||
2719 | 2719 | | |
2720 | 2720 | | |
2721 | 2721 | | |
2722 | | - | |
| 2722 | + | |
2723 | 2723 | | |
2724 | 2724 | | |
2725 | 2725 | | |
| |||
2761 | 2761 | | |
2762 | 2762 | | |
2763 | 2763 | | |
2764 | | - | |
| 2764 | + | |
2765 | 2765 | | |
2766 | 2766 | | |
2767 | 2767 | | |
2768 | 2768 | | |
2769 | 2769 | | |
2770 | 2770 | | |
2771 | 2771 | | |
2772 | | - | |
| 2772 | + | |
2773 | 2773 | | |
2774 | 2774 | | |
2775 | 2775 | | |
| |||
2779 | 2779 | | |
2780 | 2780 | | |
2781 | 2781 | | |
2782 | | - | |
| 2782 | + | |
2783 | 2783 | | |
2784 | 2784 | | |
2785 | 2785 | | |
| |||
2792 | 2792 | | |
2793 | 2793 | | |
2794 | 2794 | | |
2795 | | - | |
| 2795 | + | |
2796 | 2796 | | |
2797 | 2797 | | |
2798 | 2798 | | |
2799 | 2799 | | |
2800 | 2800 | | |
2801 | 2801 | | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
| 2806 | + | |
| 2807 | + | |
| 2808 | + | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
2802 | 2812 | | |
2803 | 2813 | | |
2804 | 2814 | | |
2805 | 2815 | | |
2806 | | - | |
| 2816 | + | |
2807 | 2817 | | |
2808 | 2818 | | |
2809 | 2819 | | |
| |||
3200 | 3210 | | |
3201 | 3211 | | |
3202 | 3212 | | |
3203 | | - | |
| 3213 | + | |
3204 | 3214 | | |
3205 | 3215 | | |
3206 | | - | |
| 3216 | + | |
3207 | 3217 | | |
3208 | 3218 | | |
3209 | 3219 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
0 commit comments