I did an experiment to find out exactly how much space we could save. I
took all the Javascript modules, which get loaded during startup, and
dumped the code into a file. The file is 1 MB and when I put it through
Webpack, it brings it down to 650 KB. Of course, this isn't practical for
empty.html, but it was an interesting experiment anyway, and it did work
properly.

I wonder what other optimizations we could do for the HTML store that would
improve the storage size.

For instance, if I dump the entire store area div into a file (which is 2.0
MB) and gzip it, the output is 0.35 MB. The store area actually accounts
for 95 % of the file size, I believe, with boot being only 75 KB. For
empty.html it is 2.18 vs 0.37. While this is probably not the best option,
gzipping the store and base64 encoding it (which increases the size by 4/3)
is a realistic option, at lease for the $:/core tiddler. Since empty.html
entirely consists of the $:/core tiddler (I just checked), that would
definitely reduce the file size.

Obviously there is something inefficient about the HTML storage system
currently being used, because the plugin.info file in TiddlyServer is 1.7
MB and is virtually identical to the JSON stored in the HTML file if I'm
not mistaken. One reason for this is that the double quote, which is 1 byte
long and appears everywhere, is expanded to 6 bytes in the HTML file
("). This also applies to angle brackets. The plugin.info file is
generated with JSON.stringify(core), but the store file is generated with
JSON.stringify(core, null, 2), which uses two space indentation and line
breaks. However, like I said, this is only creates a 15% increase in file
size, compared to gzipping.

As an interesting side note, GZipping the plugin.info file gives an output
of 0.31 MB, which is almost the same as the HTML representation.

Just some thoughts.
Arlen

On Fri, Sep 13, 2019 at 4:03 PM Mohammad <[email protected]> wrote:

> A modular approach!
>
> * core (minimum essential tools)
> * themes
> * languages
> * plugins
> ** highlight.js
> ** katex
> ** codemirror
>
> <https://miro.medium.com/max/1740/1*2uJmEEUimE1S0S0MfNNtFQ.png>
>
> url:
> https://medium.com/5000-things/learning-from-lego-a-step-forward-in-modular-web-design-d8ff953f45a8
>
> On Friday, September 13, 2019 at 10:29:44 PM UTC+4:30, Mat wrote:
>>
>> Just a thing I've been reflecting over:
>>
>> *The easier it is to install plugins*, either permanently install them
>> or - perhaps even more importantly - to do a temporary use+delete install...
>>
>> *...the less the need and pressure to include functionality in the core /
>> std distro.*
>>
>> The coming "dynamic loading of plugins
>> <https://groups.google.com/forum/#!topic/tiddlywiki/Fdi955ap4a4>" is a
>> very welcome step in this direction. I can't tell if this is an
>> implementation of the request to Provide a mechanism to register plugins
>> after boot <https://github.com/Jermolene/TiddlyWiki5/issues/2547>. Another
>> addition was the implementation of making tag pills work for multi-tiddler
>> DnD imports. A more general idea would be a handle to DnD filtered lists
>> <https://github.com/Jermolene/TiddlyWiki5/issues/2843>. A further step
>> would be to Extend Download button to offer adding plugins
>> <https://github.com/Jermolene/TiddlyWiki5/issues/3952>. And eventually
>> we'll hopefully be able to solve the Big One, i.e a library that serves a
>> federated collection of plugins.
>>
>> Apropos this, if installing and removing plugins were totally painless,
>> would it be possible to excise features from the core / standard distro?
>> Just curious.
>>
>> <:-)
>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywikidev/06c2d171-0304-4193-9587-bf50371908e9%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywikidev/06c2d171-0304-4193-9587-bf50371908e9%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/CAJ1vdSQ0T9Asv46Pr8PO9NCZf96Sr7ghoskXq8f6Uq0K6BrR5Q%40mail.gmail.com.

Reply via email to