#21109 closed Cleanup/optimization (fixed)
Performance regression due to wrap_database_errors
| Reported by: | Anssi Kääriäinen | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 1.6-beta-1 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Djangobench comparison between 1.5.x and 1.6.x revealed a problem with database error wrapping. Somewhat surprisingly the reason for the regression is functools.wraps. In addition it is possible to use @cached_property for connection.wrap_database_errors.
The regression was around 10% for query_iterator and around 50% for raw_sql djangobench benchmarks.
A patch is available from https://github.com/akaariai/django/commit/eafc373c16350abe51c565c8aefbe36cabf5219e. There is a minor comment fix to be done, otherwise ready for checkin.
Discussion about performance of 1.5.x vs 1.6.x: https://groups.google.com/forum/#!topic/django-developers/ytr3j8suVxE
In 94001421321bd8808c4027a72aa32a1eef005764: