On 14/01/11 01:41, Alex Brollo wrote:
Just to give an example: i wrote a different algorithm
for
[[en:s:template;Loop]], naming it [[en:s:template;Loop!]] and I asked for
100 and 101 dots with them into an empty sandbox preview.
These are results:
Sandbox, empty, preview:
Preprocessor node count: 35/1000000
Post-expand include size: 1858/2048000 bytes
Template argument size: 450/2048000 bytes
Expensive parser function count: 0/500
Sandbox, 2 calls to loop to print 100 and 101 dots, preview
Preprocessor node count: 1045/1000000
Post-expand include size: 2260/2048000 bytes
Template argument size: 1551/2048000 bytes
Expensive parser function count: 0/500
Sandbox, 2 calls to loop! to print the same dots, preview
Preprocessor node count: 193/1000000
Post-expand include size: 2300/2048000 bytes
Template argument size: 680/2048000 bytes
Expensive parser function count: 0/500
Is there really no useful feedback from these data? Really there's no
correlation with "server load"?
Yes, there is a correlation between all of those values and server CPU
time. In particular, the much smaller preprocessor node count implies
in particular implies that your version will be much faster.
However, I'm not sure how that obtained that result, since
{{loop!|100|x}} just expands to {{loop|100|x}}, since it hits the
default case of the #switch. When I try it, I get a preprocessor node
count of 1069, not 193.
Your version is certainly much faster for a count of 5, rather than
100. For 100 repetitions of {{loop!|5|x}}, I get:
<!--
NewPP limit report
Preprocessor node count: 2201/1000000
Post-expand include size: 1000/2048000 bytes
Template argument size: 600/2048000 bytes
Expensive parser function count: 0/500
-->
<!-- Served by srv199 in 0.646 secs. -->
For 100 repetitions of {{loop|5|x}}, I get:
<!--
NewPP limit report
Preprocessor node count: 31401/1000000
Post-expand include size: 1000/2048000 bytes
Template argument size: 15500/2048000 bytes
Expensive parser function count: 0/500
-->
<!-- Served by srv245 in 5.043 secs. -->
An empty preview takes 0.368s, so that implies that your version is
about 17 times faster for a count of 5. That's very close to the ratio
of preprocessor node counts.
This is exactly the kind of optimisation that competent editors like
you can and should be doing.
-- Tim Starling