| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
@perfloop-agent This is pretty good. I think it needs work, but it is good. |
Sorry, something went wrong.
|
@lemire Cool! The agent can deal with feedback if you leave it here. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
convert_utf16_to_utf8_safe currently routes every input through a conservative slicing loop that repeatedly bounds how many code units may be converted into the remaining output space. For the common case — ASCII data with an exactly-sized output buffer — that caution is pure overhead.
This PR adds a fast path ahead of the slicing loop, taken only when all of the following hold:
Inputs that fail any guard fall through to the existing loop unchanged, so non-ASCII, undersized-buffer, and out-of-range inputs keep their current behavior exactly.
Performance
On workload Haswell ASCII UTF-16-to-UTF-8 safe conversion, 256 code units, exact output capacity, median ns/op changed from 139.9 to 42.5; paired median delta 97.5 (at least 19/20 confidence interval 95.8 to 99.0 from 10 pairs).
An independent verification rebuilt both trees and reproduced the shape with seven paired runs: 35–37 ns/op for this change versus 97–100 ns/op for the comparison.
Testing
Authored and verified by Perfloop: every claim above was co-measured on both trees and independently re-verified before submission — the full record is public: case_tksym8s1mb. Replies from this account are human-approved, and a human operator is accountable for this contribution.