await vs then (v4)

Revision 4 of this benchmark created on


Setup

const promise = new Promise((resolve) => {
	setTimeout(() => {resolve('done')}, 50); 
});

Test runner

Ready to run.

Testing in
TestOps/sec
await
const exec = async () => {
	console.log(await promise);
}

exec();
ready
then
const exec = () => {
	promise.then((result) => {
		console.log(result);	
	})
}

exec();
ready

Revisions

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