Hong-Kong-Districts-Info / hktrafficcollisions

Shiny app dashboard of HK traffic collisions that result in injury. | 香港車禍傷亡資料庫:利用互動地圖和儀表版,將香港車禍位置和相關數據可視化。
Other
8 stars 2 forks source link

Perf: Use `debounce` to slow down query filter reactive expression #86

Closed KHwong12 closed 2 years ago

KHwong12 commented 2 years ago

Summary

This branch improves the performance of the app by adding debounce() to reactive expressions.

Changes

The changes made in this PR are:

  1. Wrap the query filter reaction expression inside the debounce() function. The query reactive expression will only be computed after .75 s of inactivity from users (i.e. users do not adjust the filters in the collision map panel for 0.75 seconds).

Check


Note

The optimal debounce time window could be figured out by considering how fast people will check/uncheck the boxes for the vehicle type/collision type, while balancing the time to generate the output.