Hey stef.

First of all,  thank you so much for trying this out. I agree that
nanopass in Racket is way to slow (triply (or 10x) so in
DrRacket....), and it really shouldn't be so slow. And I would love to
work with you to help speed it up.

>    (require compiler/compile-file)
>    (compile-file "c.rkt")

The probelm with this is that the reader is currently not able to read
the file. The following file however will allow `compile-file` to
work:

#lang racket

(require compiler/compile-file)
(current-directory "src/racket-to-c") ; Replace with path to c.rkt

(read-accept-reader #t)

(parameterize ([current-namespace (make-base-namespace)])
  (compile-file "./c.rkt"))

Another thing is that you don't need to run the compiler here, so much
as the macro expander.

Hope this helps.

~Leif Andersen


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.
>
> 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. :)
>
> I thought I might just be able to essentially call:
>
>     (require compiler/compile-file)
>     (compile-file "c.rkt")
>
> and then normally profile that, but compile-file seems to choke on the #lang.
>
> After more reading, tried this:
>
>     (require compiler/cm)
>     (require profile)
>     (profile (managed-compile-zo "./c.rkt"))
>
> which I can run with racket, but which gives me totally opaque profiling 
> data. (Ditto with errortrace on.) (And I can't get it to run in DrRacket at 
> all because it doesn't understand PWD or something.)
>
> --
> 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.

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