I wanted to do performance benckmark test among my javascript framework and other frameworks.And I found the "TodoMVC" benchmark test.A lot of people use the result of this test.It seems reasonable.But I can't understand the "asyncTime" of this test.
var startTime = now();
testFunction(prepareReturnValue, contentWindow, contentDocument);
var endTime = now();
var syncTime = endTime - startTime;
var startTime = now();
setTimeout(function () {
setTimeout(function () {
var endTime = now();
callback(syncTime, endTime - startTime);
}, 0)
}, 0);
This is the code snippet to get "syncTime" and "asyncTime".
Why does it use two "setTimeout" to get "asyncTime"?
Dose it make sense?
This is the original repository. https://github.com/Matt-Esch/mercury-perf