-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Describe the bug
require('cyberchef') takes roughly 3s to 4s. Tested on both Node.js 10 and 12. Might be much worse without a fast SSD.
To Reproduce
console.time('require');
require('cyberchef');
console.timeEnd('require');Expected behaviour
A couple of ms
Desktop (if relevant, please complete the following information):
- OS: Ubuntu 19.10
- Browser: Node.js
- CyberChef version: 9.20.3
Screenshots
Additional context
3s might be somewhat acceptable in a long-running server process, but unfortunately it's beyond acceptable in an Electron app where startup time without cyberchef is otherwise instant.
It appears that a lot of time is spent by "esm.js". I tried compiling a wrapper script using ncc but it fails. It seems like it tries to load some of the web stuff, even if I explicitly require('cyberchef/src/node/index.mjs')
Using import with --experimental-modules doesn't make it fast at all. Edit: correction, explicitly doing import chef from "cyberchef/src/node/index.mjs"; brings it down to like 2s.
Would it be possible to compile a single bundle for node just like it's done for the web version?
