question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Performance hit in a django view

See original GitHub issue

We saw a performance hit on one of our stats pages where we query around 800 rows of data each one of them has around 15-20 columns, some of them query json fields and some arrays.

We discovered that the issue is in django-dirtyfields, which we use a lot, but not in this specific view.

screenshot from 2018-09-05 21-19-42

There is no easy way to turn off the checks, we patched the _as_dict method as a workaround.

Would be great if we could have a way to turn the dirtyfields off in specific cases where its not needed and not just globally with FIELDS_TO_CHECK.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
YAmikepcommented, Sep 17, 2018

Hi @romgar

I work with @OrDuan I created a PR to show our current solution using a queryset method if that can help: https://github.com/romgar/django-dirtyfields/pull/134

IMO, it’s quite hacky as it requires to override some core django components so if you have a better solution, feel free to ignore all or most of it. 😄

Thanks

0reactions
LincolnPuzeycommented, Feb 5, 2022

Since no-one objected to my suggestion above, I went ahead and documented it in #193. Going to close this issue now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Performance and optimization - Django documentation
However: most performance problems in well-written Django sites aren't at the Python execution level, but rather in inefficient database querying, caching, and ...
Read more >
Guide to Django Performance Testing and Optimization - Toptal
In this article, I would like to talk about five common methods to optimize your web project's code. I will use Django, but...
Read more >
Solving Performance Problems in the Django ORM
The vast majority of performance problems in a web application are related to accessing the database. Unless you are dealing with large amounts...
Read more >
guidelines for speeding up template rendering performance
I've already attempted to perform all database access in the view, such that the template only hits RAM and not the DB engine....
Read more >
Data Performance Tips with Django - YouTube
Most performance problems in web applications come down to one thing: the database. In this webinar, veteran #Python developer Andrew ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found