You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sql queries —using the function in js code blocks, or within sql code blocks— can depend on variables that change often, such as the value of an interactive range slider.
The performance of these queries can suffer from the sheer quantity of queries sent during interaction, as they need to be executed in turn. Furthermore, it is a huge waste of compute, since all the queries but the last correspond to an invalidated state of the cell, and are discarded after execution.
This problem generalizes to all asynchronous functions.
Registering asynchronous functions per cell—so that each cell only runs one query at a time, and skips the queries launched by cells that have been invalidated—could lead to a dramatic performance boost.
The text was updated successfully, but these errors were encountered:
mbostock
changed the title
Register asynchronous functions for interactive performance
Serialize asynchronous evaluation to improve performance
Jun 17, 2024
This is mostly a problem with DuckDB-Wasm or anything that’s using web workers to compute asynchronously; if the computation is running in the main thread, it tends to be serialized anyway because JavaScript is single-threaded; though there are equivalent problems if a cell is e.g. calling fetch: you’ll make many fetches that are discarded only to consider the response of the last one.
What we want here is an opt-in or opt-out mechanism that makes it easy to serialize computation, so that we don’t compute a variable too many times in parallel and waste resources.
sql
queries —using the function in js code blocks, or within sql code blocks— can depend on variables that change often, such as the value of an interactive range slider.The performance of these queries can suffer from the sheer quantity of queries sent during interaction, as they need to be executed in turn. Furthermore, it is a huge waste of compute, since all the queries but the last correspond to an invalidated state of the cell, and are discarded after execution.
This problem generalizes to all asynchronous functions.
Registering asynchronous functions per cell—so that each cell only runs one query at a time, and skips the queries launched by cells that have been invalidated—could lead to a dramatic performance boost.
The text was updated successfully, but these errors were encountered: