On Wed, Feb 10, 2016 at 4:58 PM, stef <muf...@gmail.com> wrote:
> I've been trying out nanopass 
> (https://github.com/nanopass/nanopass-framework-racket) and its tutorial 
> scheme-to-c compiler (https://github.com/LeifAndersen/racket-to-c). However, 
> Racket takes easily 20s to bytecompile the c compiler, which is totally 
> unacceptable, especially with Racket's normal flow of resetting the 
> environment on every compile.
>
> How can I profile this so I can figure out what's taking so long? "raco make 
> --vv" is totally uninformative and I don't see any profiling library for 
> macros.
>
> To be clear, I'm not specifically worried about nanopass or this compiler as 
> such, but about trying similar macro-heavy strategies to implement languages 
> later. Typed Racket has similar huge performance problems, so I'm actually 
> worried about fundamental limitations of Racket as a host.

First, you shouldn't worry about Typed Racket's performance problems
as a sign of fundamental issues -- they're really all in the type
checker itself, and thus not fundamental to building languages in
Racket.

>
> However, TR is far too big for me to poke around in (I tried). I mostly get 
> what nanopass is doing though, and the slowness is more surprising, so I 
> thought it would make a better starting point for learning how to improve 
> macro performance.
>
> So first step: measure what the compiler is actually doing. :)

Here's what I recommend to profile "foo.rkt" (this is how I profile
Typed Racket):

1. make sure there isn't a `foo_rkt.zo` file in the `compiled` directory
2. do the following (at the prompt, for example):
     > (profile (dynamic-require "foo.rkt" #f))

That's it -- you should get reasonable profiling data.

>  (And I can't get it to run in DrRacket at all because it doesn't understand 
> PWD or something.)

DrRacket does understand `current-directory`, but it may not be set to
what you expect when you start. If you want to write a program that
references files relative to the source file they're in, then I
recommend using `define-runtime-path`.

Sam

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