we're updating the global state once per second (to ensure that the "now playing" / "next track starts in X seconds" notifications are up-to-date)
the search query is re-run whenever global state changes
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?
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 toshow_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 ofstate
(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?