PERF: stop reprocessing the entire accumulated response on every streaming chunk #32
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/a0-symbolics#32
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Finding
The current streaming log path repeatedly processes the entire accumulated message for each chunk:
helpers/log.py::LogItem.stream()does roughly:Log._update_item()then secret-masks and truncation-checks that full cumulative string before storing it. For a response of total length N delivered in many chunks this trends toward O(N²) character work on the backend, plus repeated allocation/copying.The WebUI receives repeated updated log records containing the growing full content. The message renderer's markdown path performs conversions,
marked.parse()and HTML sanitization over the content when rendering/updating. This can create the same cumulative-reparse pattern in the browser for long streamed Markdown/code output.The response log limit permits up to 250,000 characters, so this is not only theoretical.
Direction
Make streaming incremental while preserving final sanitization/security semantics.
Backend candidates:
old_content + chunkand re-masking the entire prefix per chunkFrontend candidates:
Security requirement: optimization must not permit secrets split across chunk boundaries to flash unmasked, and HTML must remain sanitized before insertion.
Acceptance