JeffersonLab / jaws-admin-gui

Web admin interface for JAWS
https://ace.jlab.org/jaws
MIT License
0 stars 0 forks source link

Buffer Table Changes / Limit Render Frequency #2

Closed slominskir closed 2 years ago

slominskir commented 2 years ago

The problem: Web browser locks up if lots of new data added while app is already running. Not an issue if data is added BEFORE app is running as app will buffer changes until high-water mark is reached on initial page load. If data is loaded AFTER app is running then it will render for each new update event. In the worst case scenario of re-adding all the existing records each update event results in TWO renders - first to splice out old record then again to insert new one.

The solution: We probably need to not use the reactive feature of Tabulator and instead use Tabulator updateOrAddData function as it appears to allow providing multiple changes at once (with single render). We could then manually buffer changes to no more than one batch update per second or so.

slominskir commented 2 years ago

One issue with fix is that processing is now done in giant batches. This locks up app for many seconds. We need to process in smaller chunks at a time (or use a WebWorker) to keep GUI responsive.

slominskir commented 2 years ago

Another interesting finding is it appears to be much more expensive to update the data then to render the entire data from scratch. Trying to keep the user's place (scroll position, row selection, filters, etc.) comes at a high price apparently. Need to experiment further with alternative API methods such as replaceData.

slominskir commented 2 years ago

This ticket is mainly about a specific library (Tabulator), that we don't use any more, so it is replaced by https://github.com/JeffersonLab/jaws-admin-gui/issues/21