Replies: 2 comments 3 replies
-
Hi @linonetwo the core refresh cycle needs to be entirely synchronous for performance. I don't see a way to get filter execution onto another thread because it would introduce asynchronous communication. Using worker threads for rendering works well, but only if one is rendering a bitmap; it does not work well when rendering DOM nodes. We might be able to use worker threads for things like precomputing indexes that are used in filter evaluation. |
Beta Was this translation helpful? Give feedback.
-
@Jermolene So only filter related widgets will need to rewrite, we don't need to touch the whole widget rendering process this time, nor need to run filter in another thread, like in #6550 (comment) . And we can only add this in a new async list widget, don't need to make other widgets async. I find DOM rendering is usually very fast, other widgets don't need to be async at all, and only filters on sidebar slow the huge wiki down.
Even with indexer, some of my filter will still be slow, like
If we are going to make an async version of list widget, it could have an loading indicator, means it has staled content, or filter evaluation is debounced. And user can click on loading indicator to force a sync filter evaluation. If developers like this, then other widgets that accepts filter expression could also adapt this async filter usage.
This will be a good chance to add first usage of Promise into TW. If promise is not useable in current TW core, maybe we can use Observable style, no browser API or library needed, simply add a new filter related method, that returns an Async list widget refresh its subwidget tree when filter execution complete. Old logics that relys on return value of if($tw.styleWidgetNode.refresh(changes,$tw.styleContainer,null)) {
var newStyles = $tw.styleContainer.textContent; and async widgets only used in UI that only human will read, where no JS will read things from elements. And provide an async fiber filter tiddlers method for plugin developers to use. |
Beta Was this translation helpful? Give feedback.
-
Filter steps could have been executed separatly, separated by
requestIdleCallback
, so huge wiki's filter calculation won't hurt mouse scrolling and typing experience.Update: or use
https://developer.chrome.com/blog/new-in-chrome-129#yield
This is basically same as async widget rendering, because list widget will need to wait for filter calc complete.
Performance!
Beta Was this translation helpful? Give feedback.
All reactions