ariya/esprima — pull request #232 by asukhachev (2014-03-24 19:46:22+00:00)
Title: Replace wrapTrackingFunction() with inline location tracking.

NOTE: That commit was stacked on top of another one you already merged. I cancelled the original request and re-sending it again as a single commit. This is not work in progress btw, it is finished.

Summary: Apparently node is not very good at executing these wrapped
functions. Bringing the code closer to the master implementation, but
using local vars instead of the marker stack (markStart/markEnd/markEndIf).

The idea is that all parseXXX functions should return nodes with
range/loc properties set when the tracking is on (master doesn't always
follows it though). I also think this implementation is easier to
maintain and less error-prone than the wrapping one.

I profiled it on a fairly large codebase (5k files/19MB of JS):

Tracking off: master = 3.3s, harmony = 3.2s, my patch = 3.3s (harmony is slightly faster)
Tracking on: master = 5.9s, harmony = 7.8s, my patch = 5.5s (makes it slightly faster than master vs 30% slower)

Test Plan: npm test