I would also like to know more about this topic.  I have never done any 
rigorous tests, however for my application which takes about 7 seconds to load, 
I have observed the following:

* there is no big startup difference between running the application as "racket 
run.rkt" (which loads the already compiled .zo files from disk) and running an 
executable (which has the .zo files bundled in the executable, so presumably 
already in memory).
* while the application creates a GUI frame and a complex set of widgets at 
startup, that part of code runs very fast, so most of those 7 seconds are spent 
loading modules
* my application does not use macros (except what is already there in racket 

In the end I just did a "lazy-require" for the main application and just added 
a splash screen (which still takes 1-2 seconds to show up) so the user has 
something to admire while the application loads up.

Best Regards,

On Thursday, April 27, 2017 at 6:04:15 AM UTC+8, Dupéron Georges wrote:
> Hi all!
> Some of my libraries take a while to load: just adding a (require mylib) to 
> an empty #lang racket/base file bumps the compile time from 0.5s to 1.5s, 
> even if no bindings from the library are used. After experimenting a bit, it 
> seems that the overhead is mainly due to other modules which are transitively 
> required (typed/racket, syntax/parse, …).
> Assuming that all the files except the main one are already byte-compiled 
> with raco make, what are the factors which affect compile times when a 
> library is (possibly transitively) required? Note that we're talking about 
> milliseconds here, but when a lot of modules are required, these can add up.
> 1. Number of bindings directly provided?
> 2. Number of bindings provided by transitively-required modules (including 
> those which are not re-provided, and are not in the main file's namespace)
> 3. Number of files which are transitively required?
> 4. Size of the fully expanded code (or size of the bytecode)?
> 5. Compile-time operations, e.g. within a begin-for-syntax in a 
> (transitively-)required module?
> 6. When a module is required at several meta-levels, does it affect the 
> compile time significantly, or is it roughly the same cost than requiring it 
> only once?
> 7. Something else?
> Point 5 seems to matter, as compiling a.rkt still prints "Hello" even if 
> b.rkt is already compiled:
> a.rkt:
> #lang racket/base
> (require "b.rkt")
> b.rkt:
> #lang racket/base
> (require (for-syntax racket/base))
> (begin-for-syntax (displayln "Hello"))
> However, I'm not sure what operations can cause compile-time code to be run 
> in this situation. My (possibly incorrect) understanding is that macros are 
> executed only once (when expanding the code), but the code to the 
> right-hand-side of a (define-syntax foo costly-operation), and the code 
> within a (begin-for-syntax …) will both be run each time the module is 
> required.
> What I would like is to learn a few "good practices" and gotchas concerning 
> compile-time performance.

You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to