#22608: Migrations optimizer slow (due to double working?)
--------------------------------------+------------------------------------
     Reporter:  davids                |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  Migrations            |                  Version:  master
     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 davidszotten):

 my project, which spawned this ticket has certainly improved

 when i raised the ticket:

 `17353606 function calls (17308702 primitive calls) in 39.818 seconds`
 vs
 `3650282 function calls (3640151 primitive calls) in 9.895 seconds`

 same code today (didn't re-run `makemigrations`; they are mostly the same
 38, + 10 new ones added in django

 `4268279 function calls (4178349 primitive calls) in 9.825 seconds`
 vs
 `3907185 function calls (3829169 primitive calls) in 9.213 seconds` (same
 old slow laptop)


 details:

 {{{
 Wed Jan  7 22:37:59 2015    separate.dat

          4268279 function calls (4178349 primitive calls) in 9.825 seconds

    Ordered by: internal time
    List reduced from 553 to 15 due to restriction <15>

    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     28160    1.399    0.000    2.268    0.000
 
/Users/david/dev/django_source/django/db/models/fields/__init__.py:336(deconstruct)
       471    1.292    0.003    1.292    0.003 {method 'execute' of
 'psycopg2._psycopg.cursor' objects}
      5009    0.800    0.000    1.256    0.000
 
/Users/david/dev/django_source/django/db/models/fields/related.py:309(swappable_setting)
     28672    0.738    0.000    1.036    0.000
 
/Users/david/dev/django_source/django/db/models/fields/__init__.py:137(__init__)
 855100/849476    0.569    0.000    0.576    0.000 {getattr}
     19325    0.305    0.000    0.448    0.000
 /Users/david/dev/django_source/django/db/models/options.py:721(_expire_cache)
        94    0.292    0.003    0.292    0.003 {method 'commit' of
 'psycopg2._psycopg.connection' objects}
     31534    0.259    0.000    5.680    0.000
 
/Users/david/dev/django_source/django/db/migrations/state.py:396(construct_fields)
    407619    0.189    0.000    0.232    0.000
 /Users/david/dev/django_source/django/db/models/options.py:348(swapped)
 61368/188    0.177    0.000    0.785    0.004
 
/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py:145(deepcopy)
    690682    0.144    0.000    0.147    0.000 {method 'get' of 'dict'
 objects}
    150051    0.133    0.000    0.133    0.000 {delattr}
 144008/144006    0.128    0.000    0.299    0.000 {isinstance}
    166461    0.127    0.000    0.127    0.000 {method 'update' of 'dict'
 objects}
     50220    0.107    0.000    0.224    0.000
 /Users/david/dev/django_source/django/apps/config.py:168(get_models)
 }}}


 {{{
 squashed.dat% stats 15
 Wed Jan  7 22:44:14 2015    squashed.dat

          3907185 function calls (3829169 primitive calls) in 9.213 seconds

    Ordered by: internal time
    List reduced from 546 to 15 due to restriction <15>

    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
       392    1.457    0.004    1.458    0.004 {method 'execute' of
 'psycopg2._psycopg.cursor' objects}
     25440    1.202    0.000    1.980    0.000
 
/Users/david/dev/django_source/django/db/models/fields/__init__.py:336(deconstruct)
      4832    0.773    0.000    1.226    0.000
 
/Users/david/dev/django_source/django/db/models/fields/related.py:309(swappable_setting)
     26028    0.758    0.000    1.028    0.000
 
/Users/david/dev/django_source/django/db/models/fields/__init__.py:137(__init__)
 773770/768262    0.514    0.000    0.520    0.000 {getattr}
     21612    0.339    0.000    0.495    0.000
 /Users/david/dev/django_source/django/db/models/options.py:721(_expire_cache)
     28422    0.239    0.000    5.281    0.000
 
/Users/david/dev/django_source/django/db/migrations/state.py:396(construct_fields)
    397942    0.185    0.000    0.227    0.000
 /Users/david/dev/django_source/django/db/models/options.py:348(swapped)
 52884/164    0.157    0.000    0.704    0.004
 
/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py:145(deepcopy)
    168181    0.146    0.000    0.146    0.000 {delattr}
    619322    0.135    0.000    0.138    0.000 {method 'get' of 'dict'
 objects}
 130099/130097    0.115    0.000    0.265    0.000 {isinstance}
    151382    0.114    0.000    0.114    0.000 {method 'update' of 'dict'
 objects}
     52222    0.110    0.000    0.236    0.000
 /Users/david/dev/django_source/django/apps/config.py:168(get_models)
      4371    0.089    0.000    0.459    0.000
 
/Users/david/dev/django_source/django/db/models/fields/related.py:1803(__init__)
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22608#comment:21>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.96ead020b8109991e68efe068d343b18%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to