Array.from vs Array for-loop vs Set - Sequential allocation, shift, and by-value deletion (v5)

Revision 5 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Set
const a = new Set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40])

// by-value deletion
a.delete(30)
a.delete(40)
ready
Array for-loop
const a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]

// by-value deletion
a.splice(a.indexOf(30), 1)
a.splice(a.indexOf(40), 1)
ready

Revisions

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