Michael Matz wrote:
Hi,
On Wed, 23 Apr 2008, josef reidiner wrote:
Interesting, I think gsub works little different so I try implement little different version. Problem with replace on string with different length of substitute is that each call must move some char in internall char strorage...so if gsub instead of replacing append can be better
This is true, but not how gsub currently is implemented. If you do that, then yes, gsub might potentially be faster.
I test it on Thursday or Friday and write here result.
Cool.
Ciao, Michael.
So I implement it (code of it in test file which I attach). Speed improve is really significant. here is my test results: (different size change : for ;; ) new gsub user time: 377 system time: 2 jano replace_all user time: 810 system time: 1 (same size change : for ;) (this quite surprise me) new gsub user time: 364 system time: 1 jano replace_all user time: 530 system time: 3 (remove - change : for ;) new gsub user time: 368 system time: 0 jano replace_all user time: 622 system time: 2 So what you recommend??? remove replace_all and have only new gsub or stay both? welcome any comments on code Pepa