diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-30 12:56:16 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:17 -0300 |
| commit | 4020d55aca63f2ba0b3d9bf580f36b0f4ee66f43 (patch) | |
| tree | 8c6d42d3443bc0e309d7b95fca2b23eab026a408 /src/detached/wire.zig | |
| parent | 3921bfe63980552eddeaa930d5d921d9a2868b37 (diff) | |
| download | pardes-4020d55aca63f2ba0b3d9bf580f36b0f4ee66f43.tar.gz pardes-4020d55aca63f2ba0b3d9bf580f36b0f4ee66f43.zip | |
A backward search along one long line takes time in the line's length, not its square: ?a? over 117 KB goes from 6.4 s to 0.03 s
The 9P fuzzer (seed 124) hung a session for over 5 s on `?a?` in a
117 KB file of one line. A backward search is every forward match up to
the limit, so Regex.find ran once per match. Each call looked back from its
start to the line's start, and forward to the line's end, over the whole
line each time. That is quadratic, and the step budget, which counts only
mvzr's steps, never saw it. find now keeps where it last learned a line
starts and ends in the same text, and looks back only to there. The
literal prefix's look back stops at the known part of the line.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/detached/wire.zig')
0 files changed, 0 insertions, 0 deletions
