I’m actually not sure how they compare, performance-wise. My gut feeling is that each[field]get[field]
may be faster.
… and some quick tests in my largest wiki (25360 total tiddlers, 1740 tags) support that:
Here’s the data from Maurycy’s Advanced Performance plugin. I ran each filter three times, and you can see that the each
filter is consistently more efficient at scale—though the difference may be less noticeable in a smaller wiki.
Edit: Just for fun, I also compared [each:list-item[field]]
with [get[field]enlist-input[]unique[]]
:
And each:list-item
was so much faster that I couldn’t get them both onscreen at the same time.
With unique[]
vs. each:value[]
, the difference was less dramatic…
… but again, each
wins out. So I suppose the reason to use it over other constructions that yield the same results is simply: efficiency! And I may need to go refactor some code now.
I end up tweaking nearly all the code I borrow, so it’s very possible I’ve changed it in some incompatible way. Here’s the .combobox
style from my own stylesheet:
.combobox {
--dropdown-button:20px;
position: relative;
display: inline-flex;
padding-right: var(--dropdown-button);
background-color: #fafaf9;
border-radius: 5px;
width: 10em;
}
.combobox input {
background-color: #fafaf9;
width: 10em;
}
.combobox select {
position: absolute;
/*the width of the select will be the width of the dropdown*/
width: 100%;
/*select is hard to style, so we clip the size we want and hide it, then show a pseudo-element above it*/
opacity:0;
clip-path: inset(0 0 0 calc(100% - var(--dropdown-button)));
pointer-events:all;
cursor:pointer;
}
In my wiki, that looks like this:
Tested on TW-com, the dropdown caret isn’t visible, but you can type into the input field, and clicking at the right end of the box brings up the dropdown. I’ve restyled the base input
elements in my wiki, and I suspect that accounts for the difference; you may need to adjust the width/positioning to get things to line up properly.