Closed jvasileff closed 8 years ago
I can try this out later.
Done. I call child.visit
instead of child.transform
, because:
Visitor.transform
just delegates to visit
without clients being able to change that; you’d hope the JVM would realize this and inline the call, but still, for “Visitor
s that don’t perform expensive tasks”, the whole job might be done before optimization kicks in here.visitChildren
to call visit
.visit
”. It wasn’t wrong before, per above, but still.Thanks @lucaswerkmeister, this provides a very nice performance boost. After warmup for a node-counting visitor, I'm seeing seeing an improvement from 1.2.0's 79.72ms
to a new time of 41.49ms
.
Now, this compares to 14.76ms
and 14.91ms
times using a typechecker visitor as a control. More on that to come...
Node.visitChildren()
delegates totransformChildren()
, which unnecessarily instantiates a sequence:so perhaps
visitChildren
should be rewritten as:based on tests against sdk modules, this has the potential to drop processing times by 40%+ for
Visitor
s that don't perform expensive tasks.