Hello, All!
First, this is not critical. I am in the exploratory stage, only, and open to looking at other solutions to my problem.
My PowerBuilder application needs to do (potentially) thousands of concatenations to a single string variable. True to form, PB slows down as the immutable string is appended over and over. Totally understandable with an immutable type.
Per the book "PowerBuilder 9: Advanced Client/Server Development", I'd like to write my own string handler (like a C# StringBuilder equivalent) in C++ and then "create a PBNI PowerBuilder object to use in place of the native string function".
Reading through the PowerBuilder Native Interface Programmers Guide and Reference it looks like I need to use the PBString type in C++ which does not seem to be mutable in the C++ world, either.
- Is the PBNI PBString type mutable or immutable?
- Is the PBNI PBString limited to 32K like its PB counterpart or is it more like std::string which will utilize as much available RAM as needed?
- Can my exposed function use a std::string parameter type or will PB choke on that, expecting PBString?
Disclaimer: As you may have discerned, C++ is not my thing and this is my first stab at PBNI.
I have tried to write the C++ DLL code, but I cannot figure out how to append the incoming strings because C++ appears to only pass pointers. I have not been able to find out how to get the real string value. If I have to convert from pointer to PBString to std::string, then this is a pointless exercise, anyway.
Does PB already have a mutable string type that I have either missed for 25 years? Is Appeon thinking about it? I've tried using Blobs instead of Strings, but the performance is the same.
Thanks,
Tom
Shame on me! John did mention in his book to "use the BLOB capabilities in PB". I thought that reference meant to do something like lblob += Blob("test") which, of course, was only slightly faster. I tested the BlobEdit and it went from 89,700ms to 78ms. Now, that's fast!
Thank you!
Tom
Excellent news Tom ... Yeeehaaaw!
Yes, if you know what C++ code PB is generating in the background - it sure helps to know what PB feature to use in each "Use Case". Being an old "Assembler" guy (no wise cracks here - LOL) - that is why I love studying what "C" code is generated when you build a machine code EXE. You can see how the "C" code gets optimized for each processing scenario. Then, just relate that back to PowerScript and volia, your Apps are "flying" ;-)