Closed fasterthanlime closed 9 years ago
Ongoing work in happening in branch fast-macros
.
Even though it was harder than anticipated to gain performance from this approach, it's now faster than the old one was. Along with a few dozen other optimizations/simplifications to the codebase, it's been merged into master and I'm now free to tackle #99, at last!
Macro expansion has been the black sheep of shin compilation speed for a while now (uh.. two weeks).
While e99dd94bc098fe8cb7ea1722f9576db23bc332a3 and 78c4d698c47e4844ee53a0f260e72234351cacd2 helped a lot (reduced tests from 7s to ~2.3s), I still have another idea.
Right now, if you have:
Then both
cond
andhuge-body
are passed as ClojureScript data structures like lists, vectors, maps, keywords, symbols, as if the macro was invoked as a function, like this:There are several performance problems with that:
So even though
huge-body
will not change one bit, it'll be completely thrown away and reparsed just by virtue of passing through a macro.This is sub-optimal. Instead, we can use V8/Ruby integration better.
Here's a proof of concept:
For this to work,
ast.rb
has to be modified, a bit:This will:
However, it's not an easy thing to get to work properly. Gonna have to write a few good tests to make sure it's solid before mutator can start using it. Hopefully though, the performance gains are going to be sizable.