Ok, here's the evalSandboxed code currently. Well, almost, there is one
change inside the function, but just ignore that.
/*
Run code in a sandbox with only the specified context variables in scope
*/
$tw.utils.evalSandboxed = $tw.browser ? $tw.utils.evalGlobal : function(code
,context,filename) {
var sandbox = $tw.utils.extend(Object.create(null),context);
vm.runInNewContext(code,sandbox,$tw.utils.evalFilename(filename));
return sandbox.exports;
};

In the first line, change *$tw.browser* to *true*, like this:

/*
Run code in a sandbox with only the specified context variables in scope
*/
$tw.utils.evalSandboxed = true ? $tw.utils.evalGlobal : function(code,
context,filename) {
var sandbox = $tw.utils.extend(Object.create(null),context);
vm.runInNewContext(code,sandbox,$tw.utils.evalFilename(filename));
return sandbox.exports;
};

See if that improves anything.

Arlen

On Fri, Dec 6, 2019 at 10:28 AM Florian Cauvin <[email protected]>
wrote:

> Thanks Arlen for the suggestions:
>
> The first is that evalSandboxed (in boot.js) runs every module in a new
>> context. If you change it to all of them using one separate context which
>> you create outside the function, it should speed things up some. This one
>> may vary between node versions, but it's worth a shot.
>>
>
> I located the file and function call you're refering to but I'm not
> familiar with Javascript, Node, or the internals of TiddlyWiki. Thus I
> don't feel confident trying to modify that code. Hopefully, a TiddlyWiki
> developer could look into this?
>
>
>> The second is loading the hundreds of tiddlers that make up the core.
>> There is a feature of the boot process that fixes this. Replace the
>> contents of the core folder with this file (assuming your using
>> Tiddlywiki5.1.21)
>> https://github.com/Arlen22/TiddlyWiki5-production/blob/master/5-1-21/core/plugin.info.
>> That way it's just loading one file and doing a simple JSON.parse.
>>
>
> Alright, I replaced all content of
> /usr/local/lib/node_modules/tiddlywiki/core with that file you linked to.
> It seems to have shaved a few seconds off the startup time which remained
> over 56 seconds, so while it seems to help a bit, there seems to be a
> larger issue.
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/b987363a-17f2-4444-8bb9-d6aa43c7b841%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywiki/b987363a-17f2-4444-8bb9-d6aa43c7b841%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAJ1vdSTJBRR%2BqZv13Qopcksa6%2BCCBt6Jszdxwe%3DHKXD0kWLzTA%40mail.gmail.com.

Reply via email to