Hi Carlton, 

I think I have a reasonable candidate for this and will try to find some 
time to do the comparison this week. I'll post results on the PR, or here 
if you prefer, upon completion.

Jeff

On Thursday, July 26, 2018 at 7:45:45 AM UTC-6, Carlton Gibson wrote:
>
> Hi all.
>
> Do you have a project with a slow and complicated migration history?
>
> If so, any chance you could lend a brief hand testing?
>
> See https://github.com/django/django/pull/9804 
>
> This refactors the migration graph algorithm and in principle should make 
> it significantly faster. 
> (More or less linear vs currently exponential.)
>
> Two questions: 
>
> 1. Is it correct with very complicated histories?
> 2. Is it a lot quicker? 
>
> To answer this could you profile the following script on your complicated 
> project against the PR vs against master
> (or any recent version of Django really)?
>
> Are there any errors with the PR that you don't see otherwise? 
> What's the speedup, if any?
>
> Thanks for your help! 
>
> Kind Regards,
>
> Carlton
>
>
>
> The scipt: 
> =======
>
> All it does is calculate the full forwards and backwards migration plan 
> for 
> each app in your project. It doesn't apply anything. 
>
> Dev environment should be fine. (It's the migrations, not the applied 
> state that's in play.) 
>
> As ever, please read it before running it. You can do anything similar if 
> you want.
>
> I used IPython from `django-admin shell`: 
>
> %timeit %run ./migration_graph_timing.py 
>
> If that doesn't work for you and you want me to make it actually run as a 
> stand-alone, let me know. 
>
> ----
> import sys
>
> from django.db import connection
> from django.db.migrations.loader import MigrationLoader
>
> loader = MigrationLoader(connection)
>
> backwards = loader.graph.root_nodes()
> forwards = loader.graph.leaf_nodes()
>
> print('Calculating backward plans:')
> for root in backwards:
>     loader = MigrationLoader(connection)
>     sys.stdout.write('.')
>     #print(loader.graph.backwards_plan(root))
> sys.stdout.write('\n')
> print('Calculating forward plans:')
> for leaf in forwards:
>     loader = MigrationLoader(connection)
>     sys.stdout.write('.')
>     # print(loader.graph.forwards_plan(leaf))
>
> sys.stdout.write('\nRun Done\n\n')
> ----
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/3849a1e5-2088-4d6d-9261-cded283c930d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to