Replies: 4 comments 4 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.
-
Currently each change will trigger globally "change" on wiki, and will trigger a lot of refresh on widget tree. The problem is some tiddler has list widget that will run expensive filter expression on refresh. Even the result of filter expression says there is no need to refresh, the filter execution itself is still expensive. (for example, the Recent tab, that will run its expensive days[] operator every 2-3s (debounced typing)). Most of them are useless, like Recent tab, typing in a tiddler won't cause interesting change on it. I think we can let user see those expensive filter expressions in a control panel tab, like Filter Performance. And user can set thruttle time for these filters. |
Beta Was this translation helpful? Give feedback.
-
Hi @linonetwo an alternative approach is to have your list widget use a filter that extracts a list from a tiddler, and then have a background task that runs on a timer that performs your computation, caching the results in the list tiddler step by step. I am interested in making it possible to write those sort of background tasks entirely in wikitext but obviously it would have to be JS for the moment. |
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