[racket] curious about compiler's performance on "big" automatically generated library
At Wed, 25 May 2011 09:18:24 +0200, Marco Maggi wrote:
> But when compiling the
> single R6RS number lexer library[2], it takes more than 21
> minutes.
>
> Fine, it is a very big library (>1MB) and it has a weird
> structure; but still I am surprised by such big time
> difference. AFAICT memory usage is stable and there is no
> significant swapping to disk; I just use the "plt-r6rs
> --compile" command line, no other options.
>
> Is this to be expected because of the particular structure
> of the library?
The macro expander struggles with the long `letrec', which expands the
R5RS way. Using `letrec*' makes compilation much faster, since R6RS
`letrec*' is Racket's `letrec', which the macro expander can handle
more easily.
The R6RS/R5RS `letrec' macro is supposed to detect procedure bindings
and use Racket's `letrec'. The shortcut doesn't kick in, though,
because the R5RS layer's `letrec' doesn't recognize the R6RS `lambda'.
I've pushed a change to fix that, so splitting the `letrec' as
(letrec
((user-action-<<EOF>> #f)
.....
(user-ungetc (<input-system>-user-ungetc IS)))
(letrec ((action-<<EOF>>
(lambda (yyline yycolumn yyoffset)
....)
....))
.........))
also makes compilation complete quickly.