#24743: Django 1.8.1 migrations are actually slower than 1.8?
--------------------------------------+------------------------------------
Reporter: pzrq | Owner: MarkusH
Type: Cleanup/optimization | Status: assigned
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by MarkusH):
Thank you etanol! Here is the output of the first rows sorted by
"cumtime". This clearly shows (from my perspective) a high expense in the
model's meta class: `django/db/models/base.py:72(__new__)`
{{{
1538924506 function calls (1535110811 primitive calls) in
1483.255 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 1483.272 1483.272
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/core/management/base.py:369(run_from_argv)
16/1 0.001 0.000 1483.270 1483.270
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/core/management/base.py:404(execute)
1 0.008 0.008 1482.956 1482.956
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/core/management/commands/migrate.py:55(handle)
1 0.003 0.003 1473.721 1473.721
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/migrations/executor.py:65(migrate)
1809 0.501 0.000 1471.618 0.813
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/migrations/state.py:91(reload_model)
148 0.008 0.000 1468.430 9.922
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/migrations/migration.py:72(mutate_state)
1536 0.610 0.000 1441.001 0.938
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/migrations/state.py:252(render_multiple)
239262 8.476 0.000 1440.390 0.006
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/migrations/state.py:520(render)
1352 0.058 0.000 1124.941 0.832
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/migrations/operations/fields.py:43(state_forwards)
300486/239262 13.254 0.000 834.475 0.003
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/models/base.py:72(__new__)
4083939 21.946 0.000 595.130 0.000
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/migrations/state.py:488(construct_fields)
300486 1.486 0.000 498.434 0.002
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/migrations/state.py:285(register_model)
302024 29.834 0.000 496.382 0.002
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/apps/registry.py:334(clear_cache)
40673088 270.223 0.000 388.286 0.000
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/models/options.py:711(_expire_cache)
5237503/4808935 7.485 0.000 320.286 0.000
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/models/base.py:321(add_to_class)
734946 2.335 0.000 263.046 0.000
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/utils/lru_cache.py:94(wrapper)
522243 40.921 0.000 255.000 0.000
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/apps/registry.py:153(get_models)
430612 81.365 0.000 240.780 0.001
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/models/fields/related.py:309(swappable_setting)
369388 1.661 0.000 232.581 0.001
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/models/fields/related.py:1867(deconstruct)
369388 2.692 0.000 230.388 0.001
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/models/fields/related.py:1551(deconstruct)
105539832 90.430 0.000 200.647 0.000
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/apps/config.py:164(get_models)
233 0.012 0.000 197.541 0.848
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/migrations/operations/fields.py:172(state_forwards)
3844735 113.134 0.000 176.851 0.000
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/models/fields/__init__.py:358(deconstruct)
61224 0.902 0.000 170.041 0.003
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/models/fields/related.py:2518(contribute_to_class)
61224 3.381 0.000 161.656 0.003
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/models/fields/related.py:2048(create_many_to_many_intermediary_model)
314498387 110.460 0.000 110.460 0.000 {delattr}
115 0.006 0.000 106.834 0.929
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/migrations/operations/models.py:519(state_forwards)
21800334 69.904 0.000 106.573 0.000
/usr/lib/python2.7/collections.py:104(values)
4028349 7.703 0.000 105.095 0.000
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/models/fields/__init__.py:655(contribute_to_class)
4028349 11.031 0.000 72.275 0.000
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/models/options.py:289(add_field)
300486 3.620 0.000 72.108 0.000
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/models/base.py:328(_prepare)
4032533 53.182 0.000 71.715 0.000
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/models/fields/__init__.py:137(__init__)
1686026 13.135 0.000 64.277 0.000
/home/isaac/virtualenvs/bookcore/local/lib/python2.7/site-
packages/django/db/models/fields/__init__.py:1080(__init__)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24743#comment:15>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/062.4d7d89570e771b3055932373397aeda0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.