1. Derek Hammonds
  2. PowerBuilder
  3. Tuesday, 25 September 2018 18:11 PM UTC

 

For unknown reasons, at some point, this function has become very slow.  Specifically, if you are doing a globalreplace on a large file--such as adding linefeeds to an EDI file for example--then the results are extremely slow.  For example, a 1 megabyte text file will take 5 minutes to process with this function.  A 60 meg file with take 5 hours.

By way of comparison, you can do this same sort of thing in .Net in seconds.  You can load the file in notepad++ and do a search/replace in just a couple of seconds.  Those are acceptable time frames to accomplish this task by todays standard.

We've worked around this issue by fabricating our own version of the of_globalreplace function that uses a database function in sql anywhere.  But we are still baffled as to why this function has become so incredibly slow.

 

Thanks,

Derek

 

Roland Smith Accepted Answer Pending Moderation
  1. Wednesday, 26 September 2018 16:36 PM UTC
  2. PowerBuilder
  3. # 1

I have a fast string class that has a ReplaceAll function. It uses a blob instance variable as a workspace. There are no external function calls, just pure PowerBuilder. Please give it a try and let us know how well it works.

http://www.topwizprogramming.com/freecode_stringclass.html

 

Comment
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Wednesday, 26 September 2018 05:32 AM UTC
  2. PowerBuilder
  3. # 2

Hi Derek,

the newest PFC version (https://github.com/OpenSourcePFCLibraries) contains two versions of global replace function. of_globalreplacenew function should be faster (up to 50 - 60 %).

The use of parameter ab_ignorecase = TRUE (the default) makes the replace much slower! Specify ab_ignorecase = FALSE if possible!

As Chris said both functions uses Powerbuilder string functions which are slow. So you would never get such performance like .NET or Notepad++.

Faster are Blob functions.

Maybe this can help you: https://github.com/lakeman/fastfuncs

Regards ... René

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 25 September 2018 18:30 PM UTC
  2. PowerBuilder
  3. # 3

Hi Derek;

  That looks lie a PFC object which is probably using "string" functions. I suspect that the issue with this approach using a super large text variable would impose an amazing overhead. Also, you might want to see if a newer PFC has improved that object class is your PFC library is not current.

  My suggestion though would be to convert the text into a Blob variable and then use the BlobXxxxx () commands to do that work. The Blob commands are super fast compared to string commands. Food for thought.

Regards ... Chris

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.