On 05/04/11 04:47, Tim Starling wrote:
Speaking of "fast", I did a quick benchmark
of the [[Barack Obama]]
article with templates pre-expanded. It took 22 seconds in HipHop and
112 seconds in Zend, which is not bad, for a first attempt. I reckon
it would do better if a few of the regular expressions were replaced
with tight loops.
<snip>
I have imported in my local wiki the english [[Barack Obama]] article
with all its dependencies. I can not have it parsed under either 256MB
max memory or 1 minute max execution time limits.
Hiphop helps, but there is still a highly broken code somewhere in our
PHP source code. No matter how much hacks we throw at bad code, the
algorithm still need to get fixed.
Also, browsing the generated source turns up silly
things like:
if (equal(switch2, (NAMSTR(s_ss34c5c84c, "currentmonth"))))
goto case_2_0;
if (equal(switch2, (NAMSTR(s_ss55b88086, "currentmonth1"))))
goto case_2_1;
<snip>
71 string comparisons in total, in quite a hot
function. A hashtable
would probably be better.
As I understand it, hiphop is just a straight translator from PHP to C
language but does not actually enhance the code. Just like you would use
Google translator instead of Charles Baudelaire [1].
Your code above comes from Parse.php getVariableValue() which use a long
switch() structure to map a string to a method call. If you manage to
find unoptimized code in the translated code, fix it in the PHP source
code :-b
[1] French poet, probably best known in UK/US for his work on
translating Edgar Allan Poe novels from English to French.
--
Ashar Voultoiz