-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Reduce the memory usage of the session recording processor by ~80% #60266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM assuming the test is fixed. Nice.
lib/terminal/svg_test.go
Outdated
|
||
state := vt.DumpState() | ||
svg := string(VtStateToSvg(&state)) | ||
svg := string(VtToSvg(&state)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state := vt.DumpState() | |
svg := string(VtStateToSvg(&state)) | |
svg := string(VtToSvg(&state)) | |
svg := string(VtToSvg(vt)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, cheers
Can we reduce the memory usage by another factor of 10 by making |
I did think 100 might work but after thinking about it more, 100 thumbnails would generate a thumbnail every 10 seconds for a 16 minute recording, which would be big gaps I'd like to avoid (one every 10+ seconds for hour long + is fine) 500 maybe? That would be a gap every 2 seconds for 16 minutes. Your session generated 448 thumbnails and used 62mb memory, the semaphore could limit concurrency to 4 or 8 at a time? fwiw I'm going to look at uploading the thumbnails as soon as they're generated also |
Especially if we limit the inflight processing it's fine to leave the thumbnail count as is for this PR. |
@ryanclark See the table below for backport results.
|
This reduces the memory usage of the session recording processor by ~80%.
Instead of keeping the entire terminal state (primary and alternate buffers and all the information about the glyphs) to later reconstruct into an SVG, the SVG is generated immediately (as it doesn't have to store all of the same information).
Before (325mb)

After (62mb)

changelog: Reduces the memory usage when processing a session recording by ~80%