[racket-dev] Why is current-module-name-resolver taking so much time?

From: Sam Tobin-Hochstadt (samth at cs.indiana.edu)
Date: Fri Sep 20 21:38:12 EDT 2013

On Fri, Sep 20, 2013 at 3:48 PM, Sam Tobin-Hochstadt
<samth at cs.indiana.edu> wrote:
> I decided to look at why 'make' with a fully-built install takes a
> long time, and got a surprising result.  First, the 'link-all.rkt'
> script takes about 17 seconds on my machine, almost all of it in
> `pkg-install`. I then profiled this, and got the surprising result
> that the majority of the time is spent resolving module names:

The first result of my investigation is that this is getting the value
of both `current-load-relative-directory` and `current-directory`
every single time it calls `current-module-name-resolver`, which is in
the thousands. So I think a bit of time can be saved there.  On
smaller sets of packages, this seems to make a big difference, on the
full set, less so.  It's also using exception handling for control
flow -- having `current-module-name-resolver` take a failure callback
might make this faster as well, although I wasn't about to get a build
with that change not to segfault.


Posted on the dev mailing list.