Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Set vs array.includes
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Browser:
Chrome 130
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
new Set(...)
19696.7 Ops/sec
array.includes
47255.2 Ops/sec
Tests:
new Set(...)
const strings = ['russia', 'usa', 'russia', 'france', 'russia', 'spain']; let result = []; for(let i = 0; i < 100; ++i) { const cities = strings.reduce((acc, item) => { return [...acc, item]; }, []); [...new Set(cities)]; }
array.includes
const strings = ['russia', 'usa', 'russia', 'france', 'russia', 'spain']; for(let i = 0; i < 100; ++i) { const cities = strings.reduce((acc, item) => { if (!acc.includes(item)) { return [...acc, item]; } return acc; }, []); }