Additionally, for JavaScript specifically I found this paper to be very clever and enlightening. Good code generation depends on the platform your targeting and I think this is the only way to get them performant on JS. http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.89.9...