I'm not the first one to experience this. I have a normal WP 3.5.1 installation (only a handful of plugins). I have only two languages. This page is also actually very easy on translation without any calls to
_(), etc, other than what WP does internally in the loop -- actually the page template I have has fixed language titles and meta, and no comments.
I profiled this page with qTranslate disabled and with qTranslate enabled. The numbers speak for themselves. Yes, that is 5 (five) times slower when qTranslate is enabled!
The time is in milliseconds ... 1 second vs 5 seconds page load time.
You can see the ridiculously high number of calls to functions such as
in_array(), etc. A lot of these are unnecessary, and most are expensive. You don't need preg_replace() all the time. If you absolutely have to use it and must call it so many thousands of times, using the same regex many times, then make sure you analyze and precompile the regex (use the
S modifier) so that it doesn't have to to compile it on every call. Don't use
preg_replace() when you can use
str_replace(). Don't use recursive functions if you can do it in a for/foreach loop. And so on and so forth.
There are so many inefficient aspects to the qTranslate code causing it to be so slow that it is becomes a real pain to actually fix ... I wanted to but gave up realizing I lack the time. I like qTranslate's idea of storing all languages in the same post (although it could be improved) but I'm seriously thinking of giving up on it because
- of how slow it is
- the lack of support and replies from the author
Is the author still around? Could he please at least reply to this and maybe state whether he's going to consider improving the code?
p.s. Did I mention the ghastly function names, e.g.