macrotask

Benchmark created on


Preparation HTML

<h2>hello</h2>

Test runner

Ready to run.

Testing in
TestOps/sec
macrotasks many
(async function test() {
	await new Promise(resolve => {
		
	   let counter = 0;
	   for(var i = 0; i < 10_000; i++){ 
		 setTimeout(() => { counter++; }, 0);
	   }
	   setTimeout(() => {
		resolve(counter);
	   }, 0);
		
	});
	deferred.resolve();
})();
ready
single macrotask
(async function test() {
	await new Promise(resolve => {
	   let counter = 0;
	   let funcs = [];
	   for(var i = 0; i < 10_000; i++){ 
		 funcs.push(() => { counter++; });
	   }
	   setTimeout(() => { 
		 for (var i = 0; i < funcs.length; i++) {
			funcs[i]();
		 }
		 resolve(counter);
	   }, 0);
	});
	
	deferred.resolve();
})();
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.