Skip to content
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

Improved Chat / Transcript Virtualization #1088

Draft
wants to merge 29 commits into
base: main
Choose a base branch
from
Draft

Conversation

dragonstyle
Copy link
Collaborator

@dragonstyle dragonstyle commented Jan 7, 2025

Massive improvement in log viewer performance for large samples. This has a few changes:

  • Much faster json deserialization (for large json blobs) by using transferableObjects rather than copying a string.
  • Virtualize the transcript view
  • Virtualize the chat view

After experimenting with react-window, react-virtualized, and virtuoso, I ended up extending our own virtual list to support dynamic heights and custom scroll parents (the two features we really needed to make this work).

There can be some scroll jitter at very high speed scroll (especially when there is slow loading content like images) as the heights of rows are being computed on the fly. Will experiment with a cache to remedy this.

This PR contains:

  • New features
  • Changes to dev-tools e.g. CI config / github tooling
  • Docs
  • Bug fixes
  • Code refactor

What is the current behavior? (You can also link to an open issue here)

What is the new behavior?

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

Other information:

@dragonstyle dragonstyle force-pushed the feature/json-perf branch 6 times, most recently from e62cd77 to 8405557 Compare January 10, 2025 20:38
Use a transferableObject to provide the string contents to the web worked to avoid string copying. Very noticeably faster for large json strings.

Json tweak
Some key things:

- The virtual lists don’t perform well with margins along the direction of scrolling (due to size computation), so wrap element in a container with padding to provide margins.

- Adjust css to account for above

- Use the current scrollable region as the scroll parent when computing whether to render items. This required gettings refs from the top level down to the transcript view.l

- Overscan is used to reduce jank in scrolling is items are rendered and their size is computed.
This moves it up, but we’d eventually like to get it all the way to the top of the stack (in some kind of sample specific state bag).
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