refactor(terminal): optimize log sanitization#67205
Conversation
Greptile SummaryReplaces the 33-iteration loop in Confidence Score: 5/5Safe to merge — equivalent behavior, no regressions. The regex No files require special attention. Reviews (1): Last reviewed commit: "refactor(terminal): optimize log sanitiz..." | Re-trigger Greptile |
f0a3224 to
6b0b13a
Compare
|
I ran a quick local microbenchmark to validate the performance claim in the PR body. Environment: Node Method:
Results:
So the claimed direction is real: the regex version was consistently faster in this local microbenchmark while preserving output for the tested cases. Caveat: this is still a microbenchmark on representative strings, not an end-to-end production trace. |
aa995da to
1a19628
Compare
|
Merged in This landed with the changelog follow-up and the earlier local benchmark note on-thread. Thanks for the tight refactor here, @bulutmuf — the behavior stayed equivalent and the regex path measured faster on the representative cases I checked. |
Summary
Replaced the 32-iteration loop in
sanitizeForLogwith a single-pass regex (/[\x00-\x1f\x7f]/g).Impact
replaceAlloperations to a singlereplacecall.