summaryrefslogtreecommitdiff
path: root/installed-tests
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2023-02-26 21:03:00 -0800
committerPhilip Chimento <philip.chimento@gmail.com>2023-03-04 23:40:32 -0800
commite9dfa02f1d7df0ef2155600633b833efb3fa5477 (patch)
treeefb2b8741774057ac666fe09dc8e072dea518f39 /installed-tests
parentde647bbfaf7964edf520a96212755c9a3dfc5c2c (diff)
downloadgjs-e9dfa02f1d7df0ef2155600633b833efb3fa5477.tar.gz
esm: Improve startup time by delaying imports of native and GI modules
By avoiding using import.meta.importSync() and imports.gi at the top level of modules that we import during the bootstrap process, we speed up the execution of a blank file by 15%, because we don't need to go into any of the GI typelib machinery. Now, the only modules imported at startup are _print, _encoding, _timers, and console, in order to provide public global APIs. I measured the 15% speedup with `perf stat -r 10 -B`. I also used Meson's measurements of the test suite to see a noticeable effect: for example, running the CommandLine test (which starts many instances of GJS) goes goes from 5.4 to 4.9 seconds. The cost of importing these modules is instead paid at the first time they're used. This assumes that it's nearly zero cost to import the modules a second time, because they're cached. In addition, this should make debugging easier because you don't get a big log spew of importing GLib if your script doesn't import GLib.
Diffstat (limited to 'installed-tests')
0 files changed, 0 insertions, 0 deletions