Bug 7255

string functions replace(), pos(), mid() slower in PB 2019, 2021 compared to PB 11.5 Build 4740 22 October, 2021

Ankur Patel
15 September, 2021
Product: PowerBuilder Category: Compiler
Version: 2019 R3 Build: 2728
Classification: Sybase (legacy) bug Publishing: Public
Priority: P3
Status: Scheduling Reason:
Communication Status: Waiting for Appeon
Ankur Patel 22 October, 2021
#9
Hello Mark,

Honestly, I do understand the situation. I mean if you had the source code for PB 11.5 it would be pretty easy to figure out what changed between PB 11.5 and PB 12.6. But I would still like you guys to keep this issue on priority.

Thanks,
Ankur Patel
Mark Lee @Appeon 22 October, 2021
#8
Hello Ankur,

Sorry to let you know that we are still working on it and will get back to you once there's any progress.
 
We generally pay more attention to performance bugs, but you should also know that it is more difficult to fix this kind of problem, and it is more difficult, especially when the bugs are from PB12.6 or older versions.
 
Appreciate your understanding.

Regards,
Mark Lee
Ankur Patel 21 October, 2021
#7
Hello Mark,

Is there any update on this? I do understand that since you guys don't have the source code for 11.5, it would be hard to find out what changed between 11.5 and 12.6 which is causing these functions to run 3 times as slow but nevertheless our users can actually notice the application running slow in PB 2019 compared to PB 11.5, specifically in areas with a lot of string manipulation. Even the blob workaround is not as fast as PB11.5 native functions. So we really need some solution to this as soon as possible.

Thanks,
Ankur Patel
Mark Lee @Appeon 16 September, 2021
#6
Hello Ankur,

The situation is that the SAP / Appeon agreement does not allow Appeon to support older versions of PB or IM.
SAP only provided the scource code based on the SAP PB version 12.6 "Classic" edition for us, as for other older versions, sorry that we don't have their source code.
Appreciate your understanding.

Regards,
Mark Lee
Mark Lee @Appeon 16 September, 2021
#5
Hello Ankur,

The situation is that the SAP / Appeon agreement does not allow Appeon to support older versions of PB or IM.
SAP only provided the scource code based on the SAP PB version 12.6 "Classic" edition for us, as for other older versions, sorry that we don't have their source code.
Appreciate your understanding.

Regards,
Mark Lee
Ankur Patel 16 September, 2021
#4
Hello Mark,

Thanks for the confirmation. I do know that Appeon PB is built on 12.6 but I was just wondering that when SAP gave appeon the code base didn't they gave the code in some kind of version control system so you can check the history of the code and figure out what was changed between PB 11.5 and 12.6? 

Thanks,
Ankur Patel
Mark Lee @Appeon 16 September, 2021
#3
test result

Hi Ankur,

Thanks for reporting this problem and providing the test case.
I can reproduce it on our side in PB 12.6, PB 2019 & PB 2021. 
The test results you provided are almost the same as mine. See the attachment. This issue exists since PB 12.6. It is a Sybase (legacy) bug.
 
Since PB2017 was built upon the PB 12.6 code base that SAP gave Appeon - this string handling speed issue has been inherited from that earlier implementation. Appeon has not yet had time to analyze why this has been occurring in *some* implementations. 
 
We will escalate this problem to our development team for further analysis. 
We will need some time to figure it out and will get back to you if any progress we would make.

Regards,
Mark Lee
Chris Pollach @Appeon 15 September, 2021
#2
Hi Ankur;

  Thank you for bringing these items to our attention!

  As I no longer have very old versions of PB (ie: 10.0 - 11.5) any longer, I will now transfer this ticket over to the main Support / Engineering team for their review & feedback.

Regards ... Chris
Ankur Patel 15 September, 2021
#1
string_function_slowness.zip (1449KB)

Here is the attachment.
Ankur Patel 15 September, 2021
*Phenomenon:
string functions replace(), pos(), mid() slower in PB 2019 & 2021 compared to PB 11.5 Build 4740

*Reproduce Steps:
The attachment contains the following 4 zips.
1. stringclass.zip (The same zip which you can download from https://www.topwizprogramming.com/freecode_stringclass.html)
2. stringclass_with_tracing.zip: This zip contains the tracing done using powerscript functions (traceopen, traceclose etc)
3. PB115_trace_file.zip: This zip contains the pbp files generated from PB 11.5
4. PB190_trace_file.zip: This zip contains the pbp files generated from PB 2019

1. Download the attached zip file & extract stringclass.zip or download the zip file from the link(https://www.topwizprogramming.com/freecode_stringclass.html).
2. Open the pbt file in PB 11.5 Build 4740 and migrate the class.
3. Full build the target just to be sure.
4. Run the application.
5. Click on the "Standard Replace All" button and note down the time.
6. Click on the "StringClass Replace All" button and note down the time.
7. Open this workspace in PB 2019 R3 Build 2728
8. Migrate and full build the application.
9. Run the application.
10. Click on the "Standard Replace All" button and note down the time.
11. Click on the "StringClass Replace All" button and note down the time.
12. You can see that in PB 2019 it takes almost twice or even thrice the time it took in PB 11.5 for both standard string replace & stringclass replace.

Here are the times that I am getting.
PB 11.5 Build 4740
Standard Replace All: 3364 milliseconds
StringClass Replace All: 1296 milliseconds

PB 2019 R3 Build 2728
Standard Replace All: 7664 milliseconds
StaringClass Replace All: 3603 milliseconds

PB 2021 Build Build 1288
Standard Replace All: 7683 milliseconds
StringClass Replace All: 3604 milliseconds

Remarks:
After upgrading to PB 2019 from PB 11.5 we noticed that few of the actions were taking more time compared to the same code in PB 11.5 so we narrowed down the problem to string replace. While researching on this problem, I came across the following bugs and articles.
https://www.appeon.com/standardsupport/search/view?id=6339
https://www.appeon.com/standardsupport/search/view?id=2579
https://community.appeon.com/index.php/qna/q-a/mutable-string-type-needed-pbni-c-possibility#reply-9331
https://blogs.sap.com/2016/10/24/fast-string-concatenation/
https://community.appeon.com/index.php/articles-blogs/tutorials-articles/2-%20powerbuilder/189-fast-string-concatenation
The class described in the above class is the same string class that Roland has made available on the following link.
https://www.topwizprogramming.com/freecode_stringclass.html

This code uses Blob as suggested by Appeon in the other bugs linked above. But even with that approach we are not able to match the performance that we were getting in PB 11.5 with normal string replace. 

It seems like the problem here is not the string concatenation but the string Pos() and string replace() and string Mid() functions. I have traced these 2 button clicks and also confirmed the same by opening the PBP file in the profiling class view. These functions are taking twice the time in PB 2019 & PB 2021 compared to PB 11.5.

Please let me know if you need any other information.

Thanks,
Ankur Patel
OS:
All
Platform:
All
Database Type:
Database Version: