Ryan Liptak 1418c8a5d4 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%
2024-07-13 18:19:19 -07:00
..
2024-07-09 14:25:42 -07:00
2024-07-09 14:25:42 -07:00
2024-07-09 14:25:42 -07:00
2024-07-12 00:46:03 -07:00
2024-03-21 14:11:46 -07:00
2024-02-23 02:37:11 -07:00
2024-03-19 11:45:09 -07:00
2024-07-09 14:25:42 -07:00
2024-07-09 14:25:42 -07:00
2024-07-09 14:25:42 -07:00
2024-07-09 21:15:29 -04:00
2024-03-21 14:11:46 -07:00
2024-07-09 14:25:42 -07:00
2024-07-09 14:25:42 -07:00
2024-07-02 16:31:15 +02:00
2024-03-15 02:28:50 -04:00
2024-03-10 18:13:30 -07:00
2024-03-21 14:11:46 -07:00
2024-07-09 14:25:42 -07:00
2024-05-11 02:17:11 -07:00
2024-07-05 04:45:44 -04:00
2024-03-10 18:13:30 -07:00
2024-07-02 08:59:10 +02:00
2024-05-26 16:13:54 -04:00
2024-03-21 14:11:46 -07:00
2024-02-05 11:55:14 +03:30
2024-03-19 11:45:09 -07:00
2024-06-01 13:28:16 +03:00
2024-07-09 14:25:42 -07:00
2024-04-15 15:24:30 -07:00
2024-03-19 11:45:09 -07:00
2024-07-09 14:25:42 -07:00
2024-07-09 14:25:42 -07:00
2024-07-09 21:15:29 -04:00
2024-06-15 00:57:52 +01:00
2024-06-17 16:12:19 -04:00