juliangruber/intersect — pull request #4 by minuteman3 (2013-11-23 17:01:48+00:00)
Title: Add an alternative algorithm for computing the intersection of large arrays

The alternative implementation can be invoked by calling intersect with an options object:

```js
intersect(a, b, {big: true})
```

The alternative algorithm is based on using object lookups (amortized O(1) operation) reducing the time complexity of the intersection algorithm from O(n^2) to O(n). The new algorithm has higher constant factors, however, causing it to be slower on small data sets and therefor is not enabled by default.

A graph generated using matplotlib showing the relative performance of both implementations on arrays of up to 500 elements. Both algorithms are being executed on the same array on each iteration, to prevent skewing the results.
![graph detailing relative performance](http://minuteman3.github.io/minuteman3/graph.svg)