Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What I love about the guile optimizer (and some lisp optimizers in general) is that you usually have a first step of source to source optimization. That means I can write some code and see what gets inined, hoisted, unrolled and removed without having to read the bytecode assembly.

That is especially nice when writing complex macros. I remember writing a loop utility and realized I couldn't run the optimizer on code where everything was known at compile time, since guile usually optimized the loop away. (for/sum ((i (in-range 5)) i) expanded into 20 lines of code, but optimized to the integer 15 :)



The tricky think about a source-to-source transformation, is where do you store the meta-data to map the new source back to the old source, for the purposes of error reporting, debugging, and deoptimisation? You can't just map from one list to another as your optimisation function.


I think it is the same system as used when doing macro expansion. Macros use syntax objects with embedded metadata.

Both chez and guile usually produces proper error sites, so it is done in some fashion.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: