visionmedia/mocha — pull request #763 by jfirebaugh (2013-04-02 23:47:51+00:00)
Title: mocha browser runner is 10-100x slower than jasmine on equivalent suites

So @tmcw and I were petitioning to [convert Leaflet's test suite to mocha](https://github.com/Leaflet/Leaflet/pull/1479) and @mourner brought it to our attention that the result ran ten times slower (2s with mocha vs 0.2s with Jasmine).

I reproduced a similar slowdown in a simple [benchmark](https://github.com/jfirebaugh/jasmine-mocha-benchmark) which does nothing but execute 500 examples. Jasmine does it in about 0.1s, Mocha 3s.

I suspect Mocha is hitting a wall due to the latency of [window.postMessage](https://github.com/visionmedia/mocha/blob/4d95a875d8c45aa228602a6de42a9c56e5b6a9a8/support/tail.js#L39) used by the `process.nextTick` implementation. Replacing this implementation with synchronous execution of `fn` leads to a sizable performance improvement (but of course regresses #153).

I guess to improve this mocha will need a nextTick worker queue and some manual scheduling logic, so that multiple ticks can run in each setTimeout/postMessage "timeslice".