serratus-bio / serratus.io

Front-end code for Serratus project website
https://serratus.io
GNU Affero General Public License v3.0
11 stars 11 forks source link

Use debounce function to Improve performance of match count chart #148

Closed victorlin closed 3 years ago

victorlin commented 3 years ago

Current: https://serratus.io/explorer/rdrp Preview: https://dev-chart.serratus.io/explorer/rdrp

Currently, the chart contents (one rect per identity+score bin) are redrawn by D3 every time the value of a range slider changes. This makes it extremely sluggish on the average machine.

This is a common problem with web events (onChange, onScroll, etc.) and a good solution is the debounce function. Downside is a slight delay before actual invocation, but that's much more favorable than the existing lag.