A question of rendering

56 views
Skip to first unread message

Mohammad

unread,
Mar 20, 2019, 6:54:14 AM3/20/19
to tiddl...@googlegroups.com
I use frequently the $reveal widget to do conditional operations within macros. For example in the below macro I have two parts, one part with match criteria (say IF-part) and one part with nomatch criteria (say ELSE-part)

\define myMac(a:"Empty")
<$reveal type="nomatch" text="Empty" default=<<__a__>> >
do calculations
.
.
</$reveal>
<$reveal type="match" text="Empty" default=<<__a__>> >
do another calculations
.
.
</
$reveal>
.
.
.
\end


My question is: 

 Does Tiddlywiki performs the calculation in both parts and only shows the part meets the criteria?
I want to know what is the performance impact and what is the best solution here?

If TW calculates both parts, but only shows the part meets criteria, does it means no rendering is done in the part is not displayed!

-Mohammad

PMario

unread,
Mar 20, 2019, 7:54:01 AM3/20/19
to TiddlyWiki
Hi Mohammad,

Have a look here: https://tiddlywiki.com/#RevealWidget  Especially the retain parameter.

TW has to calculate the condition for both widgets, _but_ the hidden elements are removed from the DOM, by default. So if the content is hidden, It won't cause any performance impact, since the DOM is empty.

hope that helps
-mario

Mohammad

unread,
Mar 20, 2019, 8:16:36 AM3/20/19
to tiddl...@googlegroups.com
Hello Mario,
 Thank you! when you say the hidden part is removed from DOM, does it mean the script inside the ELSE-part will not be run? In other words, if retain is set to no (default) and content is hidden, does still TW process that script?

I think in TW, most of the case rendering process is the most time consuming process, if so I should not worry about cpu time TW needs to calculate the hidden part

-by rendering I mean to calculate and display the results
-by calculating, I mean to process the script like finding a prime number (time consuming) but do not display the number

--Mohammad

PMario

unread,
Mar 20, 2019, 11:01:59 AM3/20/19
to TiddlyWiki
On Wednesday, March 20, 2019 at 1:16:36 PM UTC+1, Mohammad wrote:
Hello Mario,
 Thank you! when you say the hidden part is removed from DOM, does it mean the script inside the ELSE-part will not be run? In other words, if retain is set to no (default) and content is hidden, does still TW process that script?

If retain is set to "no" (default), the "script" will not be calculated.
 
I think in TW, most of the case rendering process is the most time consuming process, if so I should not worry about cpu time TW needs to calculate the hidden part

Calculating the hidden part and rendering is the same thing here.
 
-by rendering I mean to calculate and display the results

calculating the content is expensive. Displaying the result goes with browsers maximum speed.

The main point is. If you calculate the whole list of ALL tiddlers in the hidden section it will cause a delay.
If you show a list of eg: 30 tiddlers users probably won't recognize the difference.

-mario

Mohammad

unread,
Mar 20, 2019, 11:16:48 AM3/20/19
to TiddlyWiki
Mario,
 Many thanks for clarifications!

Best
Mohammad
Reply all
Reply to author
Forward
0 new messages