constant in vs out of func

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
outside
	let total = 0;

	const TEST1 = 50;
	function add1() {
		total += TEST1;
	}

	for (let i = 0; i < 100000000; i++) {
		add1();
	}
ready
inside
	let total = 0;

	function add2() {
		const TEST2 = 50;
		total += TEST2;
	}

	for (let i = 0; i < 100000000; i++) {
		add2();
	}
ready

Revisions

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