1. Ludwin Feiten
  2. PowerBuilder
  3. Tuesday, 30 April 2019 09:58 AM UTC

Hello,

We have to concatenate 30000 strings to display data in a browser. 

As the common string processing functions in PowerBuilder are a little bit slow I wonder if the new Json object has a faster implementation of its string functions (or are the same old function used)?

Has anyone experience or knows technical inside details?

Regars, Ludwin

 

 

Sverre Tvedt Accepted Answer Pending Moderation
  1. Wednesday, 5 June 2019 13:21 PM UTC
  2. PowerBuilder
  3. # 1

During my work with serializing/de-serializing really large JSON-strings I made a couple of interesting observations.

Concatenating strings:

stringA  +=  stringB   is much faster than stringA = stringA + stringB.

Looking for patterns in strings:

looping through a large string consisting of 100K data using the MID function, one by one character, is incredibly slow, so I developed all algorithms on the POS function, which is fast.

Doing the same work directly with the various JSON handler objects is even faster, but they lack functionality (2017 R3).

 

regards,

s.

Comment
There are no comments made yet.
Kevin Ridley Accepted Answer Pending Moderation
  1. Wednesday, 1 May 2019 12:50 PM UTC
  2. PowerBuilder
  3. # 2

The JSONParser AND JSONPackage objects are brand new for PB2017.  I don't think anyone has done performance testing compared to just normal string functions like Find/Mid etc.  I would expect the new objects to be faster but have no numbers to back that up.  Why don't you run a test and post the results.  Setup something where you pull 20 or so values, and do it a few thousand times each and see which way is more efficient.  My money is on the JSONPackage object.  1 caveat, both new objects currently have a bug where they do not handle nulls.  I've put in a bug (https://www.appeon.com/standardsupport/track/view?id=2613) for this.  Status says it's been "Transferring" for the last 3 weeks, but hoping it gets fixed soon.  If you do it, please post the results here to help out others.

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 30 April 2019 19:31 PM UTC
  2. PowerBuilder
  3. # 3

Hi Ludwin;

  Check out my answer to this string concatenation performance question ...

https://community.appeon.com/index.php/qna/q-a/mutable-string-type-needed-pbni-c-possibility

HTH

Regards ... Chris

Comment
  1. Roland Smith
  2. Tuesday, 30 April 2019 20:56 PM UTC
My StringClass example uses BlobEdit.
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 30 April 2019 15:14 PM UTC
  2. PowerBuilder
  3. # 4

This free example has fast string concatenation functionality:

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

 

Comment
  1. Michael Kramer
  2. Thursday, 6 June 2019 10:25 AM UTC
Hey Ludwin, I would look at Topwiz's string class example.

I see Roland already mentioned this so he has my vote.

HTH /Michael
  1. Helpful
  1. Arnd Schmidt
  2. Thursday, 27 June 2019 11:52 AM UTC
We ended up writing a simple n_cst_StringBuilder Class with Functions we needed.

Similar to https://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html.

The lack of Performance now is the datawindow's getItemXXX() stuff.
  1. Helpful
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.