Skip to content

[stable35] perf(LogIterator): Read long lines in linear time - #2328

Merged
DerDreschner merged 1 commit into
stable35from
backport/2327/stable35
Oct 19, 2026
Merged

DerDreschner merged 1 commit into
stable35from
backport/2327/stable35

Conversation

@backportbot

@backportbot backportbot Bot commented Oct 19, 2026

Copy link
Copy Markdown

Backport of PR #2327

LogIterator reads the log backwards in chunks of 8 KB. When a line spans
several chunks, every chunk is prepended to the whole buffer before the
whole buffer is searched for a newline again. Reading a line of length L
therefore takes O(L虏) time. Such long lines can be written, for example
by occ upgrade, which forces the debug log level. A log with a few of
them stalls the "Errors in the log" setup check and the log viewer.

Remember where the line ends, only search the newly read chunk for its
start, and then read the whole line at once. This reduces the time to
O(L).

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: David Dreschner <david.dreschner@nextcloud.com>
@DerDreschner
DerDreschner merged commit 7eb7add into stable35 Oct 19, 2026
28 checks passed
@DerDreschner
DerDreschner deleted the backport/2327/stable35 branch October 19, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant