[TW5] My new Tiddlywiki shop with 1233 items. How to make it smaller and faster?

401 views
Skip to first unread message

sini-Kit

unread,
Nov 12, 2017, 10:03:30 AM11/12/17
to TiddlyWiki
Hi! I start creating new Tiddlywiki shop http://2980258.ru/heeg.html 
The problem is that it is big 4mb. I want to make it work faster.
If somebody have compressed variant of tw5 core without comments in code or any ideas?   

Riz

unread,
Nov 12, 2017, 10:44:23 AM11/12/17
to TiddlyWiki
You can use Tinka plugin to repack the core plugin. Remove the unwanted svgs, that alone will save a lot of space. Remove unnecessary page templates and control panel and all its tabs, sidebar, whatever you don't need.

You can also remove the edit templates. When you want to edit something, edit it in a different TW5, then drag and drop it to your show-piece.

BJ

unread,
Nov 12, 2017, 1:07:15 PM11/12/17
to TiddlyWiki
do you mean it is slow to load, or that it is slow to respond to clicks?

sini-Kit

unread,
Nov 12, 2017, 1:35:34 PM11/12/17
to tiddl...@googlegroups.com
Hi Riz! I like Tinka plugin. I think about repacking core plugin and modify  svg by fontawesome  icons, and removing some comments and code. But I hope, that somebody has already done it.
I don't know will my shop work fast if I convert all my items to one big plugin.

Hi BJ! My 4mb shop loads very fast but navigating (clicks) is slow. I make experiment and load to empty TW5 14000 items (20mb data base), and try to use search. It works, but slow. 

воскресенье, 12 ноября 2017 г., 21:07:15 UTC+3 пользователь BJ написал:

BJ

unread,
Nov 12, 2017, 3:07:31 PM11/12/17
to TiddlyWiki
I think that putting your tiddlers into a plugin will speed things up -

PMario

unread,
Nov 12, 2017, 3:55:50 PM11/12/17
to tiddl...@googlegroups.com
On Sunday, November 12, 2017 at 4:03:30 PM UTC+1, sini-Kit wrote:
The problem is that it is big 4mb. I want to make it work faster.
If somebody have compressed variant of tw5 core without comments in code or any ideas?   

IMO there is no advantage in making the core smaller. It doesn't get faster that way and your server already compresses the TW if it is sent over the wire.

So you transfer 583kByte over the wire. Your TW is 3.76 MByte according to the browser debug tools.

As I see, your images are dynamically loaded already. So you won't win here either.

The only real improvement could be a redesign of the PageTemplate and ViewTemplates, removing all the dynamic <$list ..> filters, and make them hardcoded.

... By the way, using web fonts instead of core svgs imo will make your stuff more complicated and even slower, since you will add a lot of additional icons, which you probably don't use.

... And you will import rendering problems. Just search for "problems with icon fonts" ....

have fun!
mario


Mark S.

unread,
Nov 12, 2017, 4:43:47 PM11/12/17
to TiddlyWiki
Thinking out loud ...

Your biggest gain would be by reducing the size of your catalog.

Imagine storing each "tiddler" as a compressed entry in a data dictionary.

When a user clicks on link to an advertised tiddler that doesn't exist yet, it would be constructed on the fly.

This would require a pretty-links parser that knows how to decompress text (whatever algorithm you use).

Might be a crazy idea.

-- Mark
Message has been deleted

BJ

unread,
Nov 13, 2017, 3:44:31 AM11/13/17
to tiddl...@googlegroups.com
I have hacked together a plugin to speed things up. It will probably cause strange errors in you application, but maybe you can modify it to work better. In any case It will show how much things could be improved

all the best bj


On Sunday, November 12, 2017 at 4:03:30 PM UTC+1, sini-Kit wrote:
tiddlers(5).json

Jan

unread,
Nov 13, 2017, 4:02:02 AM11/13/17
to tiddl...@googlegroups.com
Hi Mark, Hi Sini
It is a great Idea to use a dictionary-Tiddler to store such data...the problem I saw when thinking on this is that you can only relate two values...and here for you would at least need three.
Name, price and imagelink. So we would need something like an Arraytiddler or csv-Tiddler to solve this problem (...or am I completely wrong in this?) I think this would be a great enhancement for all of us.

Hi Sini, I greatly like your designs...I would love to have an english edition of your work.

Yours Jan
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/6d7435d9-137e-42c1-a819-99a580b26079%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

sini-Kit

unread,
Nov 13, 2017, 11:54:52 AM11/13/17
to TiddlyWiki
Thank, you BJ. With your plugin tiddlywiki shop works fast. Can you explain what it do?

var defaultFilter = "[!is[system]sort[title]]";
       
if (this.getAttribute("filter",defaultFilter)=="[list[$:/StoryList]]") return ListWidget.prototype.bjgetTiddlerList.call(this);
       
if (!this.bjcached) {
       
this.bjcache =  this.wiki.filterTiddlers(this.getAttribute("filter",defaultFilter),this);
       
this.bjcached = true;
       
}

it adds  [!is[system] to all filters I use? I hope in future TW5 edition it will be build in zoomin.js


понедельник, 13 ноября 2017 г., 11:44:31 UTC+3 пользователь BJ написал:
I have hacked together a plugin to speed things up. It will probably cause strange errors in you application, but maybe you can modify it to work better. In any case It will show how much things could be improved

all the best bj
On Sunday, November 12, 2017 at 4:03:30 PM UTC+1, sini-Kit wrote:

BJ

unread,
Nov 13, 2017, 12:27:03 PM11/13/17
to TiddlyWiki
Lists are created by this.wiki.filterTiddlers(). Every time a tiddler is modified all the filters are recreated, and it is because of this that you shop is slow. So this plugin stops the lists (apart from the storylist) from updating.

You can see the effect of this if you go to the sidebar and click the recent tab then create a new tiddler - the list of tiddlers in the 'recent tab' is not updated. It you then click the 'open tab' and then click the 'recent tab' you will see the new tiddler on the list. This is because the listwidget has been totally erased and recreated by changing tabs.

So, depending on how your shop is constructed you may see errors due to lists not beening updated.

e.g If you have search boxes anywhere they will not work correctly

sini-Kit

unread,
Nov 14, 2017, 11:08:38 PM11/14/17
to TiddlyWiki
I start workin with your plugin, and see that I add many bugs while editing. is it possible to disable/enable automatically it if I start edit TW5? Or refresh lists when I finish editing tiddler?

понедельник, 13 ноября 2017 г., 20:27:03 UTC+3 пользователь BJ написал:

BJ

unread,
Nov 15, 2017, 7:06:44 PM11/15/17
to TiddlyWiki
It is possible to refresh (recreate) the widget tree by updating a global macro, as they are controlled by the importvariables widget, not a list widget. It is possible to add an extra parameter to the list widget that would allow refresh if set. This could be used in the edit templates to allow proper editing.

BJ

unread,
Nov 16, 2017, 2:23:27 AM11/16/17
to TiddlyWiki
so you could add a variable to control the list behaviour:

ListWidget.prototype.getTiddlerList = function() {

    var defaultFilter = "[!is[system]sort[title]]";
    if (this.getAttribute("filter",defaultFilter)=="[list[$:/StoryList]]") return ListWidget.prototype.bjgetTiddlerList.call(this);
    if (this.getVariable("enablelistupdate")=="enable") return ListWidget.prototype.bjgetTiddlerList.call(this);


    if (!this.bjcached) {
        this.bjcache =  this.wiki.filterTiddlers(this.getAttribute("filter",defaultFilter),this);
        this.bjcached = true;
    }
    return this.bjcache;
};

and then set this variable in $:/core/ui/EditTemplate tiddler :


<div class=<<frame-classes>>>
<$vars enablelistupdate="enable">
<$fieldmangler>
<$set name="storyTiddler" value=<<currentTiddler>>>
<$keyboard key="((cancel-edit-tiddler))" message="tm-cancel-tiddler">
<$keyboard key="((save-tiddler))" actions=<<actions>>>
<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditTemplate]!has[draft.of]]" variable="listItem">
<$transclude tiddler=<<listItem>>/>
</$list>
</$keyboard>
</$keyboard>
</$set>
</$fieldmangler>
</$vars>
</div>


 


On Wednesday, November 15, 2017 at 5:08:38 AM UTC+1, sini-Kit wrote:

sini-Kit

unread,
Nov 20, 2017, 1:09:09 PM11/20/17
to TiddlyWiki
Thank you BJ, but it works not in that way, I wanted.  I want to enable lists update in
/*
Update the document body with the class "tc-dirty" if the wiki has unsaved/unsynced changes
*/

SaverHandler.prototype.updateDirtyStatus = function() {
       
if($tw.browser) {
                $tw
.utils.toggleClass(document.body,"tc-dirty",this.isDirty());
       
}
};


and disable lists update when TW5 not In "dirty" mode. I try to put your code to $:/core/modules/saver-handler.js but don't understand how to get constant (var a="disabled") from another .js tiddler.  



четверг, 16 ноября 2017 г., 10:23:27 UTC+3 пользователь BJ написал:

BJ

unread,
Nov 21, 2017, 3:47:16 AM11/21/17
to TiddlyWiki
It's getting a bit compliated!

I think you can put data into the $tw structure and read it in other places, but this is very hacky!

eg  $tw._userdata_= "hello";

be careful I have not try this!
Reply all
Reply to author
Forward
0 new messages