aboutsummaryrefslogtreecommitdiff
path: root/lib/std/start.zig
diff options
context:
space:
mode:
authorRyan Liptak <squeek502@hotmail.com>2024-07-13 16:54:00 -0700
committerRyan Liptak <squeek502@hotmail.com>2024-07-13 18:19:19 -0700
commit1418c8a5d49ecc38a20df07151a7fe942992aea4 (patch)
tree4386161d9e439aac1b609f8902f0e07e12c44565 /lib/std/start.zig
parent10914dc31000bc5c3b7164a4101808719d3da07f (diff)
downloadzig-1418c8a5d49ecc38a20df07151a7fe942992aea4.tar.gz
zig-1418c8a5d49ecc38a20df07151a7fe942992aea4.zip
ArgIteratorWindows: Store last emitted code unit instead of checking the last 6 emitted bytes
Previously, to ensure args were encoded as well-formed WTF-8 (i.e. no encoded surrogate pairs), the code unit would be encoded and then the last 6 emitted bytes would be checked to see if they were a surrogate pair, and this was done for any emitted code unit (although this was not necessary, it should have only been done when emitting a low surrogate). After this commit, we still want to ensure well-formed WTF-8, but, to do so, the last emitted code point is stored, meaning we can just directly check that the last code unit is a high surrogate and the current code unit is a low surrogate to determine if we have a surrogate pair. This provides some performance benefit over and above a "use the same strategy as before but only check when we're emitting a low surrogate" implementation: Benchmark 1 (111 runs): benchargv-master.exe measurement mean ± σ min … max outliers delta wall_time 45.2ms ± 532us 44.5ms … 49.4ms 2 ( 2%) 0% peak_rss 6.49MB ± 3.94KB 6.46MB … 6.49MB 10 ( 9%) 0% Benchmark 2 (154 runs): benchargv-storelast.exe measurement mean ± σ min … max outliers delta wall_time 32.6ms ± 293us 32.2ms … 34.2ms 8 ( 5%) ⚡- 27.8% ± 0.2% peak_rss 6.49MB ± 5.15KB 6.46MB … 6.49MB 15 (10%) - 0.0% ± 0.0% Benchmark 3 (131 runs): benchargv-onlylow.exe measurement mean ± σ min … max outliers delta wall_time 38.4ms ± 257us 37.9ms … 39.6ms 5 ( 4%) ⚡- 15.1% ± 0.2% peak_rss 6.49MB ± 5.70KB 6.46MB … 6.49MB 9 ( 7%) - 0.0% ± 0.0%
Diffstat (limited to 'lib/std/start.zig')
0 files changed, 0 insertions, 0 deletions