Forums / Cotonti / Development / Siena Beta Testing

Bugfixing and evaluation cycle started

GHengeveld
#28149 2011-01-29 01:01
Improve upon it then ;)

Added 16 hours 40 minutes later:

Done some research into fastest string replacement method. sprintf would be the fastest, but isn't applicable in this case. Only strtr would be an alternative worth considering. It turns out str_replace is faster when working with arrays of words. See http://www.cznp.com/blog/3/strtr-vs-str_replace-a-battle-for-speed-and-didignity

An alternative would be to not use string replacement on the end result, but on the format, replacing textual format indicators with their numbered counterparts, and use the returned numbers as index in the array of words. This does require a few more steps, so I doubt it will be faster in the end. If speed is an issue, this might be worth a try, but I think str_replace is fast enough.
This post was edited by Koradhil (2011-01-29 17:42, 13 years ago)