Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
intersect v3
(version: 0)
Comparing performance of:
a vs b vs c
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
Array.prototype.shuffle = function() { let m = this.length, i; while (m) { i = (Math.random() * m--) >>> 0; [this[m], this[i]] = [this[i], this[m]] } return this; }; var watched = []; for(let i = 0; i < 100000; i++){watched.push({programId:Math.random()});} var ignored = [...watched]; ignored.shuffle(); ignored = ignored.slice(50000, 51000);
Tests:
a
watched.filter(wObj => { return !ignored.some((iObj, ndx) => { return iObj.programId === wObj.programId; }); });
b
watched.filter(wObj => !ignored.some((iObj, ndx) => { if (iObj.programId === wObj.programId) { ignored[ndx].programId = ignored.pop().programId; return true; } return false; }) );
c
var setA = new Set(watched); var setB = new Set(ignored); var intersection = new Set([...setA].filter(x => setB.has(x))); return Array.from(intersection);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
a
b
c
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0
Browser/OS:
Chrome 125 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
a
8.8 Ops/sec
b
198.1 Ops/sec
c
237.9 Ops/sec
Related benchmarks:
intersect v2c
intersect v2d
intersect v3b
intersect v3c
Comments
Confirm delete:
Do you really want to delete benchmark?