If you need to receive quickly , and there are a lot of models (ie, O(n) does not suit), but, at the same time, the field values ​​are small and you can donate memory - you can build indices.
For example, by making an auxiliary class something like this:
class IndexedCollection extends Backbone.Collection index_by: [] initialize: -> @_indexes = {by_key: {}, by_id: {}} super _onModelEvent: (ev, model, collection, options) -> retval = super(ev, model, collection, options) id = model.id for k in @index_by v = model.get(k) @_indexes.by_key[k] ?= {} @_indexes.by_key[k][v] ?= [] @_indexes.by_id[k] ?= {} prev = @_indexes.by_id[k][id] if prev? and prev != v @_indexes.by_key[k][prev] = _.without @_indexes.by_key[k][prev], id @_indexes.by_id[k][id] = v switch ev when "add", "change" then @_indexes.by_key[k][v] = _.union @_indexes.by_key[k][v], [id] when "remove" then @_indexes.by_key[k][v] = _.without @_indexes.by_key[k][v], id retval getByIndex:(key, value) -> for id in @_indexes.by_key[key]?[value] ? [] @.get(id)
The code is an improvisation, sketch and prototype, not very optimized and tested.
And, yes, sorry for CoffeeScript, I hope the difference does not matter - on JS to write something lazy.