One thing to check is the size of the resulting bytecode file. When I
compiled it, I got a 911 KB .zo file. So the most likely reason is that
your macros are just producing a lot of code.

You can run the macro profiler (eg, `raco macro-profiler aw-schema.rkt`) to
get a summary of what macros contribute most to the compiled code size. See
https://docs.racket-lang.org/macro-debugger/index.html#(part._.Macro_.Profiler)
for more details. I also gave a talk about the macro profiler called "The
Cost of Sugar" a few years ago at RacketCon. The slides are at
http://www.ccs.neu.edu/home/ryanc/talks/racket18-sugar.pdf, and there
should be a recording online somewhere.

The usual fix is to use helper functions. There are some examples in the
slides.

Ryan


On Mon, Jul 20, 2020 at 2:08 AM Ryan Kramer <[email protected]>
wrote:

> Using DrRacket, the following file takes 18 seconds to compile without
> debugging, or about 40 seconds to compile with debugging:
> https://raw.githubusercontent.com/default-kramer/plisqin-tutorials/e844825b48137553246c64e73516d880b9068825/define-schema-answer-key/aw-schema.rkt
>
> When I say "compile", I mean that I click "Run" in DrRacket and wait for
> it to give me REPL access. But that file just defines and provides a slew
> of functions, it doesn't really do anything at runtime.
>
> (Using the command-line `racket that-file.rkt` takes only 7 seconds, which
> is OK. But many people, myself included, primarily use DrRacket.)
>
> Admittedly, this is 612 dense lines of code. So it might just be a case of
> "yeah, that's about how long it takes." But it's also possible (or
> probable?) that I have some inefficient macros somewhere. Are there any
> tools/techniques I can use to help me reduce the compilation time?
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/40e40eff-a0be-4850-9360-c9648cb5b8d9o%40googlegroups.com
> <https://groups.google.com/d/msgid/racket-users/40e40eff-a0be-4850-9360-c9648cb5b8d9o%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CANy33q%3D1d1ojXVrcsM1mYCa2%2BcLkN2-x7x0WM197BukAA%3DRuzA%40mail.gmail.com.

Reply via email to