Skip to content

Investigate whether janky scrolling can be avoided with elements that resize #11

@SyntaxColoring

Description

@SyntaxColoring

We're currently eagerly buffering all entries into memory so that, when they come into view, we can render them immediately without an await I/O call. This is all to avoid janky behavior with our virtualized scrolling library.

log-viewer/src/LogView.tsx

Lines 118 to 122 in 59915ef

// Ideally, this call to get entry data would be async, and we would initially show a loading
// placeholder. That would let logIndex avoid having to buffer all the data in memory up-front.
// Unfortunately, React Virtuoso has a lot of trouble with elements changing height as you
// scroll upward. So this needs to be instant to avoid things jumping around.
const rowData = logIndex.getEntry(index);

This is really unfortunate because it consumes a lot of memory.

Open questions:

  • Is there a way to tune our current library (React Virtuoso) to handle this case better?
  • Is there another library that handles this case better?

If the answers to these questions are both "no," we still have other options. Like:

  • Mitigate memory consumption by buffering only the messages, not the timestamp or other metadata.
  • Add a "low-memory mode" where line wrapping is disabled. Then, we would precompute the height of each entry by counting the number of \n characters in the message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions