Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Fastest way of removing items from array 2 that also appear in array 1
What is the fastest way of removing items from array2 that are in array1. filter vs includes vs map
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:138.0) Gecko/20100101 Firefox/138.0
Browser:
Firefox 138
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
.filter() with .includes()
911931.2 Ops/sec
.map()
996270.4 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var a1 = ["fox", "drawing", "art", "animal", "posture", "fur", "sketch", "creativity", "playful", "standing", "wildlife", "illustration", "detail", "nature", "creative expression", "artist", "unique", "tail", "stance", "animal behavior", "whimsical", "illustration style", "fine art", "drawing techniques", "imaginative", "hand-drawn"]; var a2 = ["dance", "celebration", "lights", "fox", "drawing", "art", "colors", "whimsical", "floor", "party", "evening", "creative expression", "artist", "unique", "tail", "stance", "shadows", "entertainment", "people", "socialize", "energy", "rhythm", "colorful", "bright", "texture", "ambiance", "nightlife", "mood", "design", "pattern", "event space", "nightlife scene", "sound", "celebration area"];
Tests:
.filter() with .includes()
const uniqA = a1.filter((x) => !a2.includes(x))
.map() with .includes()
const uniqA2 = []; a1.map((x) => !a2.includes(x) ? uniqA2.push(x) : x)