Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
setRange
when copying output chunks to the final buffer in `Cod…
…edBufferWriter` Similar to google#885, this optimizes some more buffer copying to `memcpy`. Becuase the chunks can be very small, we use a simple loop as before on small chunks and `setRange` on large chunks. The chunk size to check for when to use a loop is somewhat arbitrarily chosen as 20. In many benchmarks the chunks are either too small (less than 10 bytes) or a more than a hundred bytes, so in the benchmarks I've tried it doesn't matter whether the threshold is 20, 30, or 40. The slowness in dart2js is probably caused by the `Uint8List` allocation, to be passed to `setRange` as the source. Results from the same benchmark in google#885. Before numbers are using the changes in google#886. | | Before | After | Diff | |------------------------------|------------|------------|---------------------| | AOT | 122,741 us | 114,582 us | - 8,159 us, -6.6% | | JIT | 94,880 us | 92,317 us | - 2,483 us, -2.6% | | dart2js -O4 | 258,250 us | 266,000 us | + 7,750 us, +3.0% | | dart2wasm --omit-type-checks | 195,300 us | 169,166 us | -26,134 us, -13.3% | AOT and JIT tested on x64.
- Loading branch information