Delete in a loop vs change length (v2)

Revision 2 of this benchmark created on


Setup

const itemCount = 50000
let items = new Array(itemCount).fill('Hello World')
const toDelete = 300

Test runner

Ready to run.

Testing in
TestOps/sec
Loop
items = items.slice(0, itemCount - toDelete)
ready
Truncate Length
items.length = itemCount - toDelete
ready

Revisions

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