-
-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
In case you are interested, I just published a faster implementation of the same algorithm: lovasoa/fast_array_intersect.
Here are the things you could improve in your version :
- Fill the initial map using the smallest of the arrays, not the first
- iterate over arrays using
for(var i=0; i<a.length; i++)instead offor(var i in a) - implement a premature stopping condition as soon as the intersection is empty
- (only in ES6) use a
Mapinstead of an object
Metadata
Metadata
Assignees
Labels
No labels