Skip to content

perf(cli, conversation): Stop cloning config per event in c show - #1249

Open
JeanMertz wants to merge 1 commit into
mainfrom
perf/conversation-show-config-clones
Open

JeanMertz wants to merge 1 commit into
mainfrom
perf/conversation-show-config-clones

Conversation

@JeanMertz

Copy link
Copy Markdown
Collaborator

jp c show on a 9,138-event conversation spent 2.4 seconds on its
main thread building the details block, against 76 ms to load the
conversation. Counting turns through iter_turns() and reading the
last timestamp through last() each resolved and cloned the full
PartialAppConfig for every event in the stream. The command now uses
turn_count() and last_turn_event(), which read event content only,
and finishes in about 90 ms of main-thread work. The confirmation
prompt's details block used the same two calls and gets the same fix.

ConversationStream::last() itself walked the stream forward and
cloned the config at every event to return the final one. It now steps
back from the end and folds the config deltas once, returning the same
event and config. pop() and Extend call it and benefit too.

Signed-off-by: Jean Mertz git@jeanmertz.com

`jp c show` on a 9,138-event conversation spent 2.4 seconds on its
main thread building the details block, against 76 ms to load the
conversation. Counting turns through `iter_turns()` and reading the
last timestamp through `last()` each resolved and cloned the full
`PartialAppConfig` for every event in the stream. The command now uses
`turn_count()` and `last_turn_event()`, which read event content only,
and finishes in about 90 ms of main-thread work. The confirmation
prompt's details block used the same two calls and gets the same fix.

`ConversationStream::last()` itself walked the stream forward and
cloned the config at every event to return the final one. It now steps
back from the end and folds the config deltas once, returning the same
event and config. `pop()` and `Extend` call it and benefit too.

Signed-off-by: Jean Mertz <git@jeanmertz.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant