Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
testing js
(version: 0)
Comparing performance of:
red vs set
Created:
7 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
const arr = [1, 2, 1, 1, 3, 1];
Tests:
red
const arr = ['@1', '@2', '@1', '@1', '@3', '@1']; arr.reduce((prev, curr, i, arr) => { if (arr.indexOf(curr) === i) { prev.push(curr.slice(1)); } return prev; }, []);
set
const arr = ['@1', '@2', '@1', '@1', '@3', '@1']; const a = [...new Set(arr)]; a.map(m => m.slice(1));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
red
set
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:
Array clone
Petuwok1
Array mutation VS creation
Javascript Array.prototype.push vs index assignment
Arr clear
Comments
Confirm delete:
Do you really want to delete benchmark?