Hi, On Tue, 22 Apr 2008, Josef Reidinger wrote:
gsub is slower. That's also expected, as it needs to copy the whole string.
Ciao, Michael.
I post it in another note about performance of different string size to replace, which I before forget send. In zypper is replaced '\n' for some ' ' (not exactly set how many).
testcase when to and from have different size: zypper gsub boost user time: 817 system time: 1 jano replace_all boost user time: 830 system time: 0
I think that's just an artifact. gsub and replace_all use mostly the same inner loop, on the same inputs: one .find call, one .replace call. gsub just also hoisted the constant length arguments out of the loop body. So gsub does strictly more work than replace_all (the string copy). Ciao, Michael. -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org