Repository navigation
Conversation
|
Thanks for profiling! Your profile is from v0.87.10. Since then, #905 (v0.89.2) made prompt scanning much cheaper. Are you confident the changes are still needed? |
|
Got it! I'll update this week and see if there's still issue without my change. |
|
I compared this implementation on the lastest version as well (v0.96.1) by inserting a single text in different buffer sizes.
When running 600 updates and we get about half the samples with the change than without it. after the change: Notice the On a side note, after this profile I realise that relabelling is still taking quite a lot of time most probably because we are still scanning all the agent headings in the |
|
Agent headings now update when a fragment is created, rather than being rescanned on every streamed append. Updated the PR with the optimisation for agent relabelling as well. The repeated labelling work during ordinary streaming appends is now gone. The same 600 update benchmark that took about 25 seconds on v0.96.1 now completes in about 6 ms, with only four CPU samples recorded. This measures append-time label maintenance, excluding initial heading creation and the full rendering pipeline. |
In chat mode, streaming responses cause frequent relabeling of the entire conversation. This is expensive in long sessions: my CPU profiles showed prompt discovery taking roughly half the sampled CPU time. With multiple such sessions running in parallel Emacs bogs down quite considerably.
Disclaimer: agent-shell is v0.87.10
From what I understand the prompt overlays include text inserted at their start.
Since streamed output is inserted immediately before the live prompt, those overlays can expand over the output and hide it. Relabeling adjusts their boundaries to reveal the output.
This change gives prompt overlays front-advance so they move with the prompt automatically.
Ordinary streaming skips prompt relabelling, while response headings continue to update.
Submissions, restores, etc, would retain full relabelling.
Checklist
M-x checkdocandM-x byte-compile-file.Update: agent-heading relabelling
Updated the PR with the optimisation for agent relabelling as well. Ordinary streaming appends now skip both prompt and agent-heading relabelling.
The same 600-update benchmark took 25.84 seconds on v0.96.1 and now completes in about 6 ms (0.0061 seconds). The CPU profiles recorded 10,131 samples before and four after, with no samples in either labelling pass in the updated run.
This measures append-time label maintenance on the same three buffer snapshots, with GC enabled. Initial heading creation and the full streaming/rendering pipeline are excluded.