Do many S:/tags/Stylesheet tiddlers slow down TW?

The question came up in another thread and is interesting for my projects:

In my ongoing project (Tix) I have one master stylesheet tiddler and a dozen more for “parts” and “elements” as well as effects users can apply to them. And up to another dozen just to hide optional stuff. All in all that makes up to 25 stylesheet tiddlers depending on the user’s configuration. Many of them can be switched on or off via a checkbox that sets the $:/tags/Stylesheet tag.

Question: Would it improve performance, if I for example used another tag and flitered all those stylesheed parts together in one single “real” stylesheet tiddler tagged $:/tags/Stylesheet?

TW would then only have to apply one stylesheet per refresh instead of 20. But it would have to evaluate a filter to collect the 20 pieces.

I don’t expect it to make a noticeable difference on fast hardware, but is there a reasonable limit for such setups?

In my former project Bricks — CSS Construction Set for TiddlyWiki 5 there were about 80 pieces of rather dynamic CSS using lots of variables. So there my coice was obvious and I built a “generator” that compiles the pieces into one static stylesheet that performs noticeably better.

Thanks and all the best,
Thomas

1 Like

That was exactly what I was about to do when I “heard” that it might be a performance issue. It sounds like the right thing to do, but I’m really not sure (without further confirmation from @jeremyruston).

Right now, I’ve left it as a hand made long list of {{transcludes}} so I’m getting the same effect, but without the $list/filter approach.

It’s worth pausing to consider, especially if your individual sheets are themselves using wikitext to build dynmamic/variable styles.

If it’s noticeably better, then that seems to point to the proposed method being an issue.

But yes, if you can use the (essentially) static output from your generator, that should be fine. I can’t do that here – it’s all dynamic. Worse, some of it is calculated per keypress so I really need to choose the most efficient mechanism.

much like your word counter works :wink:

Behind the scenes, the stylesheet mechanism actually renders a single tiddler that contains a list widget iterating through all the individual $:/tags/StyleSheet tiddlers:

Therefore, I would not expect performance to be affected by the way that style definitions are split across different stylesheet tiddlers.

3 Likes

@telmiger

It’s turltes $list widgets, Thomas, all the way down.

2 Likes