Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
testtest
(version: 0)
test
Comparing performance of:
dedup1 vs dedup2 vs dedup3
Created:
9 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var x = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'g', 'a', 'c', 'l', 't', 'f', 'e', 'c', 'd', 't', 'h', 'a', 'y', 'l'];
Tests:
dedup1
var y = []; var z = []; for (var i = x.length; i--;) { if (!z.includes(x[i])) z[i] = x[i]; } for (var i = z.length; i--;) y[i] = z[i];
dedup2
var y = []; for (var i = 0, l = x.length; i < l; i++) { if (!y.includes(x[i])) y.push([i]); }
dedup3
var y = []; x.forEach(function(i) { if (!y.includes(x[i])) y.push([i]); });
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
dedup1
dedup2
dedup3
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
object to array with lodash
JSON stringification versus simple map
find index in array performance
UINT32Array
indexof vs set123
Comments
Confirm delete:
Do you really want to delete benchmark?