|Ladies and gentlemen,|
MzScheme is awesome. Thanks to it, I've succeeded to make the Arc startup time 4 times faster, making it start under 1 second on my machine, which was what I considered an impossible challenge.
OK, let's go.
Easy step, requiring no modification/adding to any file:
This generates bytecode version of these 2 modules, in ./compiled. And MzScheme being awesome, it checks for compiled modules in this directory and use them automatically if present. And (not totally sure), it'll recompile them on-the-fly when they've changed!
$ mzc ac.scm brackets.scm
This leads to:
Now, stop here if you satisfied enough, and don't want to change anything to your Arc installation. Else, let's go a little dirty.
$ time10.pl 'rlwrap mzscheme -f as.scm < /dev/null' # BEFORE
avg max min
real 4.418 4.470 4.360
$ time10.pl 'rlwrap mzscheme -f as.scm < /dev/null' # AFTER compil
avg max min
real 3.770 3.830 3.720
First easy step was to compile Arc files to .scm ('acompile in ac.scm). Then (finding a way to) bytecode-compile them. This is more difficult, 'cause `mzc' works better when compiling modules, but nothing is impossible. But this leads to some dirt, 'cause I've found nothing better than creating a new, crappy, as-fast.scm file, and use it instead of the vanilla as.scm. And using a Perl script. And calling it in my arc(.sh) launcher script.
OK, so in as-fast.scm, I directly indicate the .zo (bytecode compiled) Arc files to load (no more use of libs.arc).
The Perl script mimics the very clever behaviour of MzScheme and will re-compile on-the-fly the .arc files when they've changed.
The .sh launcher calls the .pl script (the overhead is something like 0.012 sec when nothing has changed, so not a problem), before to call `mzscheme'.
I'm going to post the .pl and as-fast.scm in comment, but here are the stats:
Oh gosh I'll be able to code in Arc now. And script in Arc now!
$ time10.pl 'arc < /dev/null'
avg max min
real 0.938 0.980 0.920
Thanks to jcw, tc-rusho, erikb, conanite and all the others I shamefully forget for helping me understand I should not be a total moron to complain about Arc (startup) terrible perf, since I am not alone. Guys, may you enjoy this patch, because it is for you!