await vs then (v10)

Revision 10 of this benchmark created on


Setup

let i = 0;
const promise = () => new Promise((resolve) => {
	setTimeout(() => {resolve('done')}, 5); 
});

const await_exec = async () => {
	const result = await promise();
	i++
}
const promise_exec = () => {
	const result = promise();
	result.then((result) => {
		i++
	})
}

Teardown

i = 0;

Test runner

Ready to run.

Testing in
TestOps/sec
await
await_exec();
ready
then
promise_exec();
ready

Revisions

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