Re: [Wikitech-l] Speed v. Size

2013-05-30 Thread Antoine Musso
Le 30/05/13 06:34, Tim Starling a écrit : With the PHP package used at Wikimedia (5.3.10-1ubuntu3.6+wmf1), with taskset 1 nice -n-10, I get: Added that to a maintenance/benchmarks/README file: https://gerrit.wikimedia.org/r/66066 -- Antoine hashar Musso

Re: [Wikitech-l] Speed v. Size

2013-05-30 Thread Tyler Romeo
For the record, the times I mentioned above were user time and not real time, so changing the priority or affinity of the process wouldn't really affect it that much. *-- * *Tyler Romeo* Stevens Institute of Technology, Class of 2016 Major in Computer Science www.whizkidztech.com |

[Wikitech-l] Speed v. Size

2013-05-29 Thread Tyler Romeo
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%). Html::element (and other places in the Html class) prefer using

Re: [Wikitech-l] Speed v. Size

2013-05-29 Thread Chad
On Wed, May 29, 2013 at 10:21 AM, Tyler Romeo tylerro...@gmail.com 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

Re: [Wikitech-l] Speed v. Size

2013-05-29 Thread Tyler Romeo
On Wed, May 29, 2013 at 10:30 AM, Chad innocentkil...@gmail.com wrote: Sounds like you're comparing apples to oranges here. What happens to the speed when you change Html::element() and friends? To (average) page size? It seems to reduce the loading speed by about half a millisecond (kind of

Re: [Wikitech-l] Speed v. Size

2013-05-29 Thread Antoine Musso
Le 29/05/13 16:21, Tyler Romeo a écrit : 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%). Html::element

Re: [Wikitech-l] Speed v. Size

2013-05-29 Thread Chad
On Wed, May 29, 2013 at 1:39 PM, Antoine Musso hashar+...@free.fr wrote: Le 29/05/13 16:21, Tyler Romeo a écrit : 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

Re: [Wikitech-l] Speed v. Size

2013-05-29 Thread Tyler Romeo
On Wed, May 29, 2013 at 1:43 PM, Chad innocentkil...@gmail.com wrote: Perhaps. But if it's only marginally faster (like, half a ms), then the reduced output probably saves more in the long run. But without actual numbers we're really just guessing at possible micro-optimizations. Very true.

Re: [Wikitech-l] Speed v. Size

2013-05-29 Thread Tim Starling
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

Re: [Wikitech-l] Speed v. Size

2013-05-29 Thread Tyler Romeo
On Wed, May 29, 2013 at 9:26 PM, Tim Starling tstarl...@wikimedia.orgwrote: 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

Re: [Wikitech-l] Speed v. Size

2013-05-29 Thread Daniel Friesen
On Wed, 29 May 2013 18:33:03 -0700, Tyler Romeo tylerro...@gmail.com wrote: On Wed, May 29, 2013 at 9:26 PM, Tim Starling tstarl...@wikimedia.orgwrote: 37% for the larger replacement array in Html::expandAttributes(), or for the smaller one in Html::element()? And what was the test case

Re: [Wikitech-l] Speed v. Size

2013-05-29 Thread Tyler Romeo
On Wed, May 29, 2013 at 10:22 PM, Daniel Friesen dan...@nadir-seen-fire.com wrote: Also, I'd be interested to see those benchmarks re-run on PHP 5.4 now that I we know that they changed the algorithm. On PHP 5.4: htmlspecialchars with ENT_NOQUOTES: 8.548s htmlspecialchars without

Re: [Wikitech-l] Speed v. Size

2013-05-29 Thread Tim Starling
On 30/05/13 11:33, Tyler Romeo wrote: Ran another test. I tested on the string 'herllowodsiojgdsd^6' repeated 50 times, and I ran the replacement function 500,000 times. The results were: htmlspecialchars with ENT_NOQUOTES: 14.025s htmlspecialchars without ENT_NOQUOTES: 13.457s strtr: