I have a website accessible in multiple languages and I'm seeing something strange in my page load times with the different locales. Here are the load times of one of the more important pages as an example.
en_GB = 469ms
fr_BE = 545ms
nl_BE = 1.45s
I already figured out that the difference is caused by this code:
$format_number = Zend_Locale_Format::toNumber(
$number,
array( 'precision' => 2 , 'locale' => Zend_Registry::get( 'Zend_Locale' ) )
);
If I remove this code and just return the numbers unformated, all 3 locales render the page in about the same time. (+/- 500ms) I have quite a few numbers that need formatting on this page, so hence the serious impact.
I have been looking at this for quite some time now but can't find a solution, or even an explanation at that.
Any ideas?
Are you calling
Zend_Registry::get('Zend_Locale')multiple times on that page or is it called only once? You said you have quite a few numbers to format on that page. Try setting the registry value to a variable once at the beginning of your page or even in your controller:If you are indeed calling
Zend_Registrymultiple times for the same value you're essentially doing the same thing over and over again.There could also be some "deeper" difference between the internal workings of the locales themselves. Are you using
UTF-8based locales or what? This is very important as some locales could be containing much more symbols than others. There could also be an specific known/unknown issue with this set of locales on a specific OS. What OS are you running this under?