On 30/05/13 00:21, Tyler Romeo wrote: > So I ran a brief benchmark on my vagrant instance recently (nothing fancy, > just 50,000 iterations of a single line of code), and I found that > htmlspecialchars() performs *significantly* faster than strtr() (a > difference of like 37%).
37% for the larger replacement array in Html::expandAttributes(), or for the smaller one in Html::element()? And what was the test case size: how many replaced bytes compared to non-replaced bytes? If it was the strtr() in Html::element(), which is the only one which gives a size reduction, perhaps you should compare it against htmlspecialchars($s, ENT_NOQUOTES), which should use the same algorithm as plain htmlspecialchars() but with the same size reduction as strtr(). -- Tim Starling _______________________________________________ Wikitech-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitech-l
