Re: Turning off USE_L10N more than doubled my site performance!

2011-03-25 Thread Carsten Fuchs

Dear Karen,

Am 25.03.2011 01:18, schrieb Karen Tracey:

First, do you really mean USE_I18N everywhere where you have USE_L10N?

The top cumtime item:

ncalls  tottime  percall  cumtime  percall filename:lineno(function)
 183330.7060.0004.3680.000
/usr/local/lib/python2.6/dist-packages/django/utils/translation/__init__.py:23(delayed_loader)

is one whose execution time will be vastly different depending on
USE_I18N value. I cannot figure out why it would be getting called more
(or be more expensive to call) with USE_L10N = True vs. False, so I'm
thinking you must have changed USE_I18N to see the dramatic performance
difference?


During my first performance profilings, when I saw "translation" and 
"gettext" mentioned frequently in the profile stats, so my first 
reaction was indeed to switch USE_I18N off, but then I found that my 
performance only improved mildly and by a constant amount, and that I 
still had very many number-format related lines in the profile stats.


Then I switched USE_I18N on again (also because my admin-users need 
German language texts in the admin interface), and tried USE_L10N = 
False, and was surprised by the significantly faster code as described 
in my initial posts in this thread.


In summary, my previous post with the profile stats and my referring to 
the effect of USE_L10N (and not USE_I18N, which I kept on all the time) 
was correct.


(I also did all measurements several times (skipping the first page 
loads when the code was re-initialized), and reproducing this was 
reliable possible every time.)



(There are already notes in the doc that if you don't need
translation you should turn USE_I18N off, see:
http://docs.djangoproject.com/en/1.3/topics/i18n/deployment/#if-you-don-t-need-internationalization,
http://docs.djangoproject.com/en/1.3/ref/settings/#use-i18n.)


Thanks!  ;-)


Second, have you tried running with 1.3? That top call listed in the
first report no longer exists, it was removed by the fix to this ticket:
http://code.djangoproject.com/ticket/14306, motivation being performance
improvement. So it would be interesting to see how your results compare
with the current release.


Ah, thanks for pointing #14306 out, I wasn't aware of this change.

It will take me another few days until I'm ready to upgrade to 1.3, but 
as soon as I've done that I'll profile again and report my findings.


Many thanks for your help,
and best regards,
Carsten



--
   Cafu - the open-source Game and Graphics Engine
for multiplayer, cross-platform, real-time 3D Action
  Learn more at http://www.cafu.de



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Turning off USE_L10N more than doubled my site performance!

2011-03-24 Thread Karen Tracey
On Thu, Mar 24, 2011 at 10:46 AM, Carsten Fuchs wrote:

> I'd be very happy to learn what you make of this data (afaics, the problem
> could perfectly well be in my app code, not in Django).


First, do you really mean USE_I18N everywhere where you have USE_L10N?

The top cumtime item:

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
183330.7060.0004.3680.000
/usr/local/lib/python2.6/dist-packages/django/utils/translation/__init__.py:23(delayed_loader)

is one whose execution time will be vastly different depending on USE_I18N
value. I cannot figure out why it would be getting called more (or be more
expensive to call) with USE_L10N = True vs. False, so I'm thinking you must
have changed USE_I18N to see the dramatic performance difference? (There are
already notes in the doc that if you don't need translation you should turn
USE_I18N off, see:
http://docs.djangoproject.com/en/1.3/topics/i18n/deployment/#if-you-don-t-need-internationalization,
http://docs.djangoproject.com/en/1.3/ref/settings/#use-i18n.)

Second, have you tried running with 1.3? That top call listed in the first
report no longer exists, it was removed by the fix to this ticket:
http://code.djangoproject.com/ticket/14306, motivation being performance
improvement. So it would be interesting to see how your results compare with
the current release.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Turning off USE_L10N more than doubled my site performance!

2011-03-24 Thread Carsten Fuchs

Dear Russell,

thank you very much for your reply!

Am 24.03.2011 01:04, schrieb Russell Keith-Magee:

Can you share your profiling data?


Sure, gladly:

with USE_L10N = True, ordered by internal time:
http://pastebin.com/fkyF5nLw

with USE_L10N = True, ordered by cumulated time, with callees:
http://pastebin.com/GXSsV3qk


with USE_L10N = False, ordered by internal time:
http://pastebin.com/JCu3ePEu

with USE_L10N = False, ordered by cumulated time, with callees:
http://pastebin.com/3bYjsk82


[ Today I measured a difference in performance of only factor 13.832 / 
8.549 == ca. 1.6  vs. better than 2.0 yesterday, but that is probably 
related to my setting DEBUG = False for all of the above vs. DEBUG = 
True yesterday (which of course was, in the light of performance 
profiling, a stupid  oversight). ]



I'd be very happy to learn what you make of this data (afaics, the 
problem could perfectly well be in my app code, not in Django).

:-)

Best regards,
Carsten



--
   Cafu - the open-source Game and Graphics Engine
for multiplayer, cross-platform, real-time 3D Action
  Learn more at http://www.cafu.de



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Turning off USE_L10N more than doubled my site performance!

2011-03-23 Thread Russell Keith-Magee
On Thu, Mar 24, 2011 at 12:47 AM, Carsten Fuchs
 wrote:
> Dear Django folks,
>
> just an information that I would like to share (and be happy to hear some
> feedback):
...
> In summary, contrary to [3], I hope that the docs keep or add thick, fat and
> blinking warnings about the performance impacts of USE_L10N  ;-)

Can you share your profiling data? We haven't gone out of our way to
make anything slow, so I'm intrigued to know where you're seeing the
performance hit. Are you being "pecked to death by ducks" because you
have a page with lots of L10N calls, or is it one very slow call...
the more details we have, the more likely it is that we can address
the problem (or, as you say, put up a big honking warning if we can't
fix it).

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.