i18n performance killer?

0 views
Skip to first unread message

Yannick

unread,
Aug 8, 2006, 9:55:12 AM8/8/06
to TurboGears
Hi,

I've noticed that adding i18n to my app (i18n.run_template_filter=True)
is making page rendering slower. It even seems that rendering time
increases with the uptime of the TG application itself..
i.e. without i18n a typical page takes about 200-250ms to build (with
log_debug_info_filter.on = True) and with i18n it takes about 1.5s -
2s. (and up to 4s on my prod server on which the app is running since a
day now..)
I am using TG 0.9a8.

Is anyone else experiencing the same issue?
How do I go about debugging this, and finding out where TG is spending
most of its time?

Thanks,
Yannick

Yves-Eric Martin

unread,
Aug 8, 2006, 7:54:33 PM8/8/06
to TurboGears
Yannick wrote:
> Hi,
>
> I've noticed that adding i18n to my app (i18n.run_template_filter=True)
> is making page rendering slower.
[...]

> Is anyone else experiencing the same issue?
> How do I go about debugging this, and finding out where TG is spending
> most of its time?


Yes, we are experiencing what looks like the same problem. No idea
where to start with that one... but what I know is: our client is
(rightfully) very unhappy, and TG is making us look bad... so, er.....
help, please?


PS: Our site is also on TG 0.9a8 and uses i18n, and even though it is
quite simple, it gets reeeeeeaaallllyyyyy slllllloooooowwwwwwww...
After a restart, the top page renders in 1.5s ~ 2s. It quickly climbs
up to 3s ~ 4s and keeps climbing. After less than a day, it's up to
10s... After a few days (right now) it's 22s...

--
Yves-Eric

Yannick

unread,
Aug 8, 2006, 8:28:50 PM8/8/06
to TurboGears
Yves-Eric,

Found a way to fix it:

in kid/__init__.py, line 182:
remove _filters = [transform_filter] from the class definition, and put
it inside the __init__ method, this is what is should look like:
-------------------------8<-------------------------------------
class BaseTemplate(object):
# the serializer to use when writing output
serializer = output_methods['xml']

def __init__(self, *args, **kw):
self.__dict__.update(kw)
self._layout_classes = []
self._filters = [transform_filter]
-------------------------8<-------------------------------------

I am sure this is not the right fix, but at least it now works for me!
:)

The problem was that the i18n filter was added to the _filters list
each time the page was called... So of course you ended up with a huge
list of filters by the time the page received some traffic.

Cheers,
Yannick

Mark Ramm

unread,
Aug 9, 2006, 11:35:26 AM8/9/06
to turbo...@googlegroups.com
Could you open a ticket for this on trac.turbogears.org? It might be
worth it to search around a little bit to see if there's already an
open ticket on this issue, but I don't rememeber seeing one.

And this sounds like something that really ought to be fixed. So I
would hate to see your comments get lost in the shuffle.


--
Mark Ramm-Christensen
email: mark at compoundthinking dot com
blog: www.compoundthinking.com/blog

Yves-Eric Martin

unread,
Aug 9, 2006, 9:07:18 PM8/9/06
to TurboGears
Works for us too, now everyone is happy again! :-)

Thanks a lot Yannick!

Reply all
Reply to author
Forward
0 new messages