What is faster: <$list> all[current]get[field]compare.. VS <$reveal>?

117 views
Skip to first unread message

Shareda

unread,
Oct 11, 2020, 3:07:50 PM10/11/20
to TiddlyWiki
The reason is that my reveal widget implicitly adds some css class or style to my UI elements, so I have unexpected space to the right of my button.
But when I use ListWidget instead -- it's ok. The only doubt is speed of my wiki. 
So, what is faster and is the difference big: <$list> all[current]get[field]prefix[X].. VS <$reveal> depending on that value?

TW Tones

unread,
Oct 11, 2020, 5:14:50 PM10/11/20
to TiddlyWiki
I think you need to share the code in a reply

I expect its all to do with the condition you use in each. 

Otherwise, perhaps we can help you with the original problem " unexpected space to the right of my button".
Often "\whitepace trim" is use at the top of a tiddler or in a macro definition for this. and sometime the trim[] operator adds value.

Regards
Tones

bimlas

unread,
Oct 12, 2020, 2:01:21 AM10/12/20
to TiddlyWiki
Shareda,

I've researched this before too and I'm using the "list" widget because of the unnecessary DOM elements of the "reveal" widget. There is virtually no difference in speed between them, maybe the "list" is a little faster, but measure yourself: https://tiddlywiki.com/#Performance%20Instrumentation

Shareda

unread,
Oct 12, 2020, 3:17:40 AM10/12/20
to TiddlyWiki
TW Tones, here is an example code from UI preferences:
<$reveal type="match" state="$:/hb/Scrollable" text="yes">
  <$edit-text tiddler="$:/hb/CiteDivHeight" default="600" size="1" rows="1" autoHeight="no"tag=input/> <$range tiddler="$:/hb/CiteDivHeight" min="300" max="999" default="600" increment="10" tooltip='300-999px'/>
</$reveal>
Instead of this I can use List like <$list filter='[all[$:/hb/Scrollable]get[text]prefix[yes]]'> and so on.

bimlas, thanks! If (or when) I face some disturbing slow down of my wiki then I will measure the difference and place results here! Now I prefer <$list>.
понедельник, 12 октября 2020 г. в 12:01:21 UTC+6, bimlas:

Eric Shulman

unread,
Oct 12, 2020, 3:54:17 AM10/12/20
to TiddlyWiki
On Monday, October 12, 2020 at 12:17:40 AM UTC-7, Shareda wrote:
TW Tones, here is an example code from UI preferences:
<$reveal type="match" state="$:/hb/Scrollable" text="yes">
  <$edit-text tiddler="$:/hb/CiteDivHeight" default="600" size="1" rows="1" autoHeight="no"tag=input/> <$range tiddler="$:/hb/CiteDivHeight" min="300" max="999" default="600" increment="10" tooltip='300-999px'/>
</$reveal>
Instead of this I can use List like <$list filter='[all[$:/hb/Scrollable]get[text]prefix[yes]]'> and so on.

Just a few notes about the example $list you posted:

The all[...] operator takes one or more *keywords* (current, missing, orphans, shadows, tags, tiddlers) as a parameter, not a tiddler title.
To specify a literal tiddler title, use title[TiddlerName] or just [TiddlerName], like this:
<$list filter='[[$:/hb/Scrollable]get[text]prefix[yes]]'>

In place of the combination of [TiddlerName]get[text], you could write {TiddlerName!!text}, like this:
<$list filter='[{$:/hb/Scrollable!!text}prefix[yes]]'>

By default, the $list widget sets "currentTiddler" within the body of the <$list>...</$list>.
Thus, in your example code, the value of <<currentTiddler>> within the $list body will be "yes".

To leave the value of currentTiddler unchanged, you must specify an alternative variable name, like this:
<$list filter='[[$:/hb/Scrollable]get[text]prefix[yes]]' variable="something">

As an alternative, you could also preserve the value currentTiddler by adding "then<currentTiddler>" at the end of your test, like this:
<$list filter='[[$:/hb/Scrollable]get[text]prefix[yes]then<currentTiddler>]'>

Of course, if you don't use the result within the body of the $filter (as in your example, which explicitly specifies tiddler="$:/hb/CiteDivHeight"), then you can omit the variable="..." syntax entirely.
Even so, it's a good convention to use a variable whenever the $list is just being used as a conditional test. I like to use a name that describes the purpose of the test, like this:
<$list filter='[[$:/hb/Scrollable]get[text]prefix[yes]]' variable="if_scrollable_flag_is_set">

enjoy,
-e

Shareda

unread,
Oct 12, 2020, 7:12:47 AM10/12/20
to TiddlyWiki
Yeah! You are fully right! I should test and debug an example before posting it :-/
I really appreciate your time, and I'm sorry that you had to sort out my mistakes (first three of your notes). 
But without that I would not get your cool advises (the other three ones). All of them are useful for me! Thanks!
Especially THIS looks much more optimal and beautiful comparing to mine, so i take it: 
<$list filter='[{$:/hb/Scrollable!!text}prefix[yes]]'>
понедельник, 12 октября 2020 г. в 13:54:17 UTC+6, Eric Shulman:
Reply all
Reply to author
Forward
0 new messages