await vs then

Benchmark created on


Setup

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

Test runner

Ready to run.

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

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.