MongoKit is a Python wrapper on top of pymongo that adds structure and validation and some other bits and pieces. It's like an ORM but not for an SQL database but for a document store like MongoDB. It's a great piece of code because it's thin. It's very careful not to molly cuddle you and your access to the source. What I discovered was that I was doing an advanced query and with the results they we instantiated as class instances and later turned into JSON for the HTTP response. Bad idea. I don't need them to be objects really so with MongoKit it's possible to go straight to the source and that's what I did.
With few very simple changes I managed to make my restful API app almost 10 times faster!!
Read the whole story here
- Why I gave up on JQuery UI's autocomplete 20 October 2010
- In Django, how much faster is it to aggregate?
27 October 2010
- Related by category:
- fastest way to turn HTML into text in Python 08 January 2021 Python
- How much faster is Redis at storing a blob of JSON compared to PostgreSQL? 28 September 2019 Python
- Best practice with retries with requests 19 April 2017 Python
- Fastest way to find out if a file exists in S3 (with boto3) 16 June 2017 Python
- Interesting float/int casting in Python 25 April 2006 Python
- Related by keyword:
- How to JSON schema validate 10x (or 100x) faster in Python 04 November 2018
- Cope with JSONDecodeError in requests.get().json() in Python 2 and 3 16 November 2016
- Msgpack vs JSON (with gzip) 19 December 2017
- Django ORM optimization story on selecting the least possible 22 February 2019
- From Postgres to JSON strings
12 November 2013