calaldees / KaraKara

Karaoke Event System - Attendees can view and queue tracks from their mobile phones
https://karakara.uk
GNU General Public License v3.0
28 stars 9 forks source link

maybe cache search results in browser2 #118

Closed shish closed 1 year ago

shish commented 1 year ago

This feels like a waste of battery power... but on the other hand, running a search takes ~10ms, so this timer is only contributing 1% to overall CPU use

hyperapp includes a memoization function, to only re-render a section of the page when that section's inputs have changed - but right now we're passing the entire state object to show_list()

We could avoid re-running the search query once per second, by updating all of the show_list() code to only use specific rarely-changing subsets of state (and not the full object) -- is it worth the complexity? Also is it worth the extra memory cost due to keeping multiple copies of search results in RAM?

shish commented 1 year ago

React has a super easy and efficient way to do this, so it is done in browser3