jashkenas/underscore — pull request #1199 by caseywebdev (2013-07-10 17:05:52+00:00)
Title: Allow _.object to create dictionaries for O(n) lookups

This is very useful for speeding up operations like finding by a property and `intersection` (which should also get some hash lookup love #1194).

```js
// email is unique
var userByEmail = _.object(users.models, 'email');
userByEmail['john@example.com'];
userByEmail['jane@example.com'];

// which is going to be much faster than

users.findWhere({email: 'john@example.com'});
users.findWhere({email: 'jane@example.com'});
```

This complements the idea in #1194. Using dictionaries for intersection when it's possible is magnitudes faster than simple arrays.