Hmm. That is a good point. If there is little difference, then I suppose
I'll blame buildout.

$ bin/django print_time
2014-03-05T22:07:33.051634
before test
2014-03-05T22:07:40.202247
command has been run

That is A difference of 7 seconds, significantly better.

$ strace bin/django print_time 2> cmdtrace
cat cmdtrace | wc -l
54361
$ cat cmdtrace | grep 'open(' | wc -l
34233
$ cat cmdtrace | grep 'stat64(' | wc -l
13625
$ cat cmdtrace | grep 'read(' | wc -l
2706
$ cat cmdtrace | grep 'fstat64(' | wc -l
2377
$ cat cmdtrace | grep 'close(' | wc -l
1563
$ cat cmdtrace | grep 'ENOENT (No such file or directory)' | wc -l
41561

There are still almost as many files being sought for and not opened
however. I suppose that means that failing to find a file on disc is
actually not that costly.
The difference between running a command and running a test also suggests
that either:
1) Linode disc performance varies throughout the day and is better outside
buisiness hours? Nope.
2014-03-05T22:20:33.604757
before test
nosetests --verbosity 1 match_mentors -anow -s
To reuse old database "test_02_06_18_29" for speed, set env var REUSE_DB=1.
Creating test database for alias 'default'...
2014-03-05T22:21:03.106680
test has begun

2) A significant portion of the time is spent in the other imports that I'm
doing in that test file. I should have broken it out and ran that test.
I'll do that now.
2014-03-05T22:23:05.650883
before test
nosetests --verbosity 1 match_mentors -anow -s
To reuse old database "test_02_06_18_29" for speed, set env var REUSE_DB=1.
Creating test database for alias 'default'...
2014-03-05T22:23:42.127545
test has begun
That is still 37 seconds, so it is almost certainly something in the test
discovery process.
I suppose this means that digging up and mapping out the piping that runs
through nose <https://github.com/nose-devs/nose>,
django-nose<https://github.com/django-nose/django-nose>,
the django test-discovery code, and unittest.py is in order. I suppose that
will build character.

-- 
*Andrew Farrell*
Software Engineer *|* MassChallenge, Inc.
1.888.782.7820x720 *|* amfarr...@masschallenge.org
ONE Marina Park Drive *|* Boston, MA 02210


* Free m entorship, resources, coworking space. No equity taken.
 Applications now open: 2014 MassChallenge accelerator
<http://masschallenge.org/apply> Apply or refer great startups today!*

On Wed, Mar 5, 2014 at 8:45 PM, Tom Evans <tevans...@googlemail.com> wrote:

> On Wed, Mar 5, 2014 at 8:52 PM, Andrew Farrell <armorsmit...@gmail.com>
> wrote:
> > Привет Djanonaughts!
> >
> > tl;dr: django with buildout spends a lot of time looking for files that
> > aren't there when trying to do imports. How can I reduce this?
>
> (I did read :)
>
> The first thing that springs to mind is test discovery. I may be way
> off track, an easy way to test (other than read all the code/know
> already) would be a simple django management command that spits out
> the time. Comparing the time difference for that operation compared to
> when running a test should size the costs of starting django
> environment versus starting django environment and finding a specific
> test.
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFHbX1%2B6qoCp%3DprVoCZ5X-CGX%2BxBZ%3DZembJZ937Qjydd9JA92g%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2By5TLZNe15tBpX92%3D%3D-mPix%3Dg3rU_ddsYjf1r5RvCpat8DB8w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to