3 ms·
I'd like to get into Racket as a Scheme user, but I have difficulty taking it seriously when its startup times are still so high: $ time racket -e '(display
by hlandau 4y ago
I'd like to get into Racket as a Scheme user, but I have difficulty taking it seriously when its startup times are still so high:
$ time racket -e '(display "hello")'
hello
real 0m0.721s
user 0m0.598s
sys 0m0.119s
This basically rules out using it for command line scripts, which is a major class of uses for me.
- soegaard 4y agoThat command uses `#lang racket` which means it loads an awful lot of modules. Try an example with `racket/base` instead. $ time racket ~/tmp/bd.rkt hello Times: 0.12s user 0.04s system 94% cpu 0.176 total The file used $ cat ~/tmp/bd.rkt #lang racket/base (displayln "hello") Also use `raco make` to compile your scripts before running them.
- hlandau 4y agoThat gets things down to 0.183s, which is certainly an improvement. But Python manages 0.033s and Guile manages 0.022s, neither of which need a precompile step. I feel like Racket needs to spend some time optimising this. My understanding is that Racket has been doing a lot of work on overhauling its interpreter and internals recently, so I'm hopeful this will improve somehow, but it's unclear to me if they're aware of this issue or consider it a problem.
- soegaard 4y agoThe compiler was rewritten and now Chez Scheme is used as part of the pipeline from Racket to assembler. With respect to improving the startup time, the low hanging fruit has already been picked. If I understand correctly part of the problem is the number of modules that needs to be loaded from disk at startup. On my computer the first run is slower than subsequent runs due to caching. Maybe an "compile several modules into a single file" approach might improve things - but it's not trivial project.