Prefix increment (++x) vs Postfix increment (x++) (v2)

Revision 2 of this benchmark created on


Description

Use more loops and fewer loops to test prefix increment (++x) and postfix increment (x++)

Test runner

Ready to run.

Testing in
TestOps/sec
Prefix increment (++x) - fewer loops
let x = 0
for (let i = 0; i < 100; i++) {
	++x
}
ready
Postfix increment (x++) - fewer loops
let x = 0
for (let i = 0; i < 100; i++) {
	x++
}
ready
Prefix increment (++x) - more loops
let x = 0
for (let i = 0; i < 1000000; i++) {
	++x
}
ready
Postfix increment (x++) - more loops
let x = 0
for (let i = 0; i < 1000000; i++) {
	x++
}
ready

Revisions

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