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.
|
// 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.
We're currently eagerly buffering all entries into memory so that, when they come into view, we can render them immediately without an
awaitI/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
This is really unfortunate because it consumes a lot of memory.
Open questions:
If the answers to these questions are both "no," we still have other options. Like:
\ncharacters in the message.