[racket] Optimizations at the library level.

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Thu Sep 2 05:31:08 EDT 2010

Noel Welsh wrote at 09/02/2010 04:49 AM:
> GHC allows user specified rewrite rules:
> http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/rewrite-rules.html
> I don't know how effective they are in practice. 

Neat.  But I'd be fine with just a hook procedure being called with with 
just the version identifier and whatever intermediate representation the 
compiler happens to have in that version (say, a macro-expanded syntax 
tree with reference annotations).  Beyond that point, the IR is simply 
undocumented internals that can be poked around, with no special 
transformation language required.  An optimization programmer can apply 
whatever pattern-matching or whatnot they want to help with the 

Independently, a third-party PLaneT package author could try to provide 
a higher-level library for use by hook optimization programmers,  that 
abstracts across different versions of a Racket hook phase IR.  Perhaps 
it would look much like these GHC rewrite rules, "syntax-case", or one 
of the various Scheme pattern-matching and logic-programming libraries.

I am currently thinking of these pluggable optimizations as potentially 
unsafe indulgences for high-performance computing and research 
prototyping.  However, I have a greater interest in this not 
significantly impeding the other evolution of Racket (by, e.g., 
distracting Matthew or making compiler improvements more difficult).  
But if anyone who does the work has other priorities or other ideas, 
that's good.


Posted on the users mailing list.