Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



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.


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.


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 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.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: