Re:The Metapict Blog – TikZ like figures using Racket
by hlandau on Wednesday January 18, 2023 @09:28AM
(#34426962)
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:
This basically rules out using it for command line scripts, which is a major class of uses for me.
[ Parent
| on HN ]
Re:The Metapict Blog – TikZ like figures using Racket
by soegaard on Wednesday January 18, 2023 @09:48AM
(#34427220)
That 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.
Re:The Metapict Blog – TikZ like figures using Racket
by hlandau on Wednesday January 18, 2023 @09:54AM
(#34427311)
That 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.
Re:The Metapict Blog – TikZ like figures using Racket
by soegaard on Wednesday January 18, 2023 @11:41AM
(#34429052)
The 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 haning 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.