await try/catch vs promise.then.catch

Benchmark created on


Setup

function dummyAsyncFunction () {
	return new Promise((resolve, reject) => {
		setTimeout(resolve, 17);
	});
}

Test runner

Ready to run.

Testing in
TestOps/sec
async/await
async function doThing() {
	try {
		await dummyAsyncFunction()
	} catch(e) {
		// ignored
	}
}

doThing()
ready
.then.catch
function doThing() {
	dummyAsyncFunction()
		.then(() => {  })
		.catch(e => {  })
}

doThing()
ready

Revisions

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