"Reedy" posted a comment on MediaWiki.r107297.
URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/107297#c28526

Commit summary for MediaWiki.r107297:

merged some things commited in past
simplified some stuff
fixed several security issues
moved one class from core

Reedy's comment:

You realise strings are immutable, right? A new string object is created 
everytime you alter (add, remove etc) the string.

If you're wanting to get performance out of building really long strings, use a 
StringBuilder, though, unless this is 10,000's, it's not really necessary, but 
is somewhat best practise, so either way.

They would be garbage collected every iteration anyway, it's not used outside 
the scope of the loop, so not initialising it outside the loop, to then reset 
it in the loop is better

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to