pouchdb/mapreduce — pull request #194 by nolanlawson (2014-06-14 20:35:44+00:00)
Title: (#194) - avoid unnecessary allDocs call

In `adapter.js` we already optimize `allDocs` `keys` queries when `keys.length` is 0, but this has the added benefit of avoiding the unnecessary database query to get the `doc_count` in idb/websql. And even leveldb reports a performance boost for `temp-views`:

66897ms -> 63076ms (5.7% improvement)

For perspective, when you run the `temp-views` test with 10 iterations, this code would normally call `view.db.allDocs` with 0-length keys 10,000 times (because it's all insert, no update). Hence the visible impact in leveldb, and it would probably be even more in the other two.