Text Replace Performance Very Slow in FB7

Hi,

I recently noticed one of my scripts was taking quite a bit more time then when it was building in FB6.  I've extracted an example and included FB6 and FB7 versions of it (attached zip). 

In my case, the replace operation takes 5 seconds in FB6 and just shy of 10 minutes in FB7.

-Nelson

TextReplacePerf.zip (273.902 KB)

Hi Nelson

Thanks for bringing this to our attention. So far I have elimited any FB7 code changes, it appears to be a problem with the unicode version of the PCRE regex library, seems to be an order of magnitude slower but I haven't been able to figure out why. I'll contact a few people I know and see what I can find out.

Hi Nelson

I have made some progress on this. On my machine I have the first Text Replace down from 4min down to 42 sec. That’s still and order of magnitude slower than FB6, but it may be the price we have to pay for unicode support. Part of the problem is that PCRE use UTF8 for it’s unicode support, whereas FB uses UTF16. That means that as well as the string type conversions we also have to convert the match indexes, and that involves scanning the string to look for surrogate pairs etc. This is the area that I have focused on today (working to avoid scanning if there are no surrogates). I need to update my unit tests to exercise the changes I have made, once they are all passing and the coverage is good I’ll check the changes in and send you a build (hopefully tomorrow).

Hi Nelson

This build should improve the performance somewhat, although it will still be slower than FB6.

https://www.finalbuilder.com/downloads/finalbuilder/aex6/FB700_1275.exe

We are still investigating how to improve this further.