histrio / py-couchdb

Modern pure python CouchDB Client.
https://pycouchdb.readthedocs.org/
Other
120 stars 43 forks source link

speed up JSON decoding by eliminating accidental calls to chardet #35

Closed dpk closed 10 years ago

dpk commented 10 years ago

The utils.as_json method in pycouchdb is extremely slow because it uses response.text, which causes the requests module to call chardet, which is a complete waste of time because CouchDB never returns anything except UTF-8. This commit uses response.content instead, which is much faster.

In an app which queries a medium-size result (~620 rows, include_docs=true), I saw page-load times decrease from 6.10 seconds to 0.2 seconds.

niwinz commented 10 years ago

Oh, I don't know this. Thank you very much!

(I will release new version in some days, Monday probably)