Page 7 of 8
Re: PureBasic 6.40 alpha 2 is ready, surprise inside !
Posted: Sat Jan 31, 2026 1:23 am
by mk-soft
Len + String is alignment 16 byte . So String address is alignment 16 byte + offset 8
Re: PureBasic 6.40 alpha 2 is ready, surprise inside !
Posted: Sat Jan 31, 2026 5:58 am
by idle
mk-soft wrote: Sat Jan 31, 2026 1:23 am
Len + String is alignment 16 byte . So String address is alignment 16 byte + offset 8
Yes the string is unaligned.
Re: PureBasic 6.40 alpha 3 is ready, surprise inside !
Posted: Sat Jan 31, 2026 11:33 am
by Fred
2026-01-31: alpha 3 is available for Windows x64 ! A few more bugs has been fixed, and a new StringBuilder library has been added for very fast string concatenation ! Here is a small example:
Code: Select all
a$ = "Hello, World !"
CreateStringBuilder(0, 64000)
For l = 1 To 2000
AppendStringBuilderString(0, a$)
Next
b$ = FinishStringBuilder(0)
Don't hesitate to test this version if you can as we believe it's ready for larger tests.
Re: PureBasic 6.40 alpha 3 is ready, surprise inside !
Posted: Sat Jan 31, 2026 2:01 pm
by ChrisR
I just compared the new StringBuilder library with
the string builder here and with a$ = ReplaceString(Space(50), " ", "Hello World !") ; Len =13*50=650
Wow! It's really super fast, with PB_Any and the cache size. Well done
Code: Select all
StringBuilder Large concat Size(1300000) 2 ms
ExString Large concat Size(1300000) 18 ms
I just looked at what I'm currently using in my app for the code generation,
The only thing I'm missing is Right, which can be very useful, to do for ex:
Code: Select all
If RightStringBuilder(0, 4) <> #CRLF$+#CRLF$
AppendStringBuilderString(0, #CRLF$)
EndIf
AppendStringBuilderString(0, a$)
Wouldn't it be better with AppendStringBuilder(A, a$) only rather than AppendStringBuilderString(A, a$)
Thanks for adding it

Re: PureBasic 6.40 alpha 3 is ready, surprise inside !
Posted: Sat Jan 31, 2026 4:09 pm
by ChrisR
More Result:
Code: Select all
PB Way Large concat PB6.30 Size(1300000): 2025 ms
PB Way Large concat PB6.40a3 Size(1300000): 262 ms
ExString Large concat Size(1300000): 18 ms (cache 64000)
StringBuilder Large concat Size(1300000): 2 ms (cache 64000)
PureBasic 6.40 alpha 3 - C Backend (Windows - x64)
Feel the ..Pure.. Power
Sadly, I'm going to prepare a little funeral for my StringBuilder. It was really fun to do it. Sniff
Okay, we can prepare it together with HeX0R's StringBuilder Interface and mk-soft's FastString 
Re: PureBasic 6.40 alpha 3 is ready, surprise inside !
Posted: Sat Jan 31, 2026 4:38 pm
by threedslider
Even more impressive with the last version of PB
Again thanks all to Fred, Team and users !
Re: PureBasic 6.40 alpha 3 is ready, surprise inside !
Posted: Sat Jan 31, 2026 4:46 pm
by Fred
About the right() command, you should be able to do it before adding it, no? What's the real use case ?
About the naming, I was thinking to add may be some additional command like AppendStringBuilderDouble/Integer for fast number concat, that's why I put String at the end
Re: PureBasic 6.40 alpha 3 is ready, surprise inside !
Posted: Sat Jan 31, 2026 5:18 pm
by Axolotl
Shouldn't there be a limit on the length of function names? (Just kidding.)
Keep up the good work, and continue to surprise me.
Re: PureBasic 6.40 alpha 3 is ready, surprise inside !
Posted: Sat Jan 31, 2026 5:19 pm
by skywalk
Thanks!
I still have heinous crash for this line in a 30k loc app.
wmi\mp$ = UCase(mpFileNamePath$)
I will need time to shrink snippet.
Compiler crash:
Code: Select all
[11:13:12] Waiting for executable to start...
[11:13:12] Executable type: Windows - x64 (64bit, Unicode, Thread)
[11:13:12] Executable started.
[11:13:19] [ERROR] my.pbi (Line: 4292)
[11:13:19] [ERROR] Invalid memory access. (write error at address 0)
[11:13:19] [ERROR] my.pbi (Line: 4292)
[11:13:19] [ERROR] Invalid memory access. (read error at address 5220935860488)
[11:13:19] [ERROR] my.pbi (Line: 4292)
[11:13:19] [ERROR] Invalid memory access. (read error at address 5220935860488)
[11:13:19] [ERROR] my.pbi (Line: 4292)
...REPEATING UNTIL...
[11:13:22] The Program was killed.
Is there a migration tutorial?
If it is a lot, shouldn't this be a major version change?
Like version method [Major-may-break-old-code].[Minor-backward-compatible-features].[Bug-fixes] ?
Re: PureBasic 6.40 alpha 3 is ready, surprise inside !
Posted: Sat Jan 31, 2026 5:27 pm
by ChrisR
Fred wrote: Sat Jan 31, 2026 4:46 pm
About the right() command, you should be able to do it before adding it, no? What's the real use case ?
Sure, but in my case, it's really easier (and faster) to do it this way by testing the double CRLF, otherwise I'll have to do some additional testing to find out what will be written next.
Since you must have the final address, it should be fairly easy PeekS(*FinalAddress - (Len * SizeOf(Character)), Len)
But I can understand, if you prefer to stay with a pure StringBuilder, in this case, is it possible to retrieve the initial and final addresses with something like: *mem = GetStringBuilderAdress(0, [#PB_StringBuilder_Last])?
Good, for AppendStringBuilderDouble/Integer

Re: PureBasic 6.40 alpha 3 is ready, surprise inside !
Posted: Sat Jan 31, 2026 5:32 pm
by mk-soft
@skywalk
No crash with structure here...
Where does the variable "mpFileNamePath$" come from. If it comes from API, it must be corrected with PeekS.
Code: Select all
Structure udtData
iVal.i
sVal$
EndStructure
Define MyData.udtData
Filename$ = #PB_Compiler_Home
MyData\sVal$ = UCase(Filename$)
Debug MyData\sVal$
/code]
Re: PureBasic 6.40 alpha 3 is ready, surprise inside !
Posted: Sat Jan 31, 2026 6:06 pm
by skywalk
Well, this is called at different times from different sources, basically the app path and subfolders are defined in some constants:
#MY_server$ = "C:\"
#MY_app_path$ = "mypath\"
etc.
Filename = #MY_server$ + #MY_app_path$ + "some-new-file-to-load.extension"
I will make a snippet, but this is basic stuff.
A new feature should not break basic code without a major version change.
Re: PureBasic 6.40 alpha 3 is ready, surprise inside !
Posted: Sat Jan 31, 2026 6:45 pm
by Little John
Axolotl wrote: Sat Jan 31, 2026 5:18 pm
Shouldn't there be a limit on the length of function names? (Just kidding.)

Re: PureBasic 6.40 alpha 1 is ready, surprise inside !
Posted: Sun Feb 01, 2026 12:39 am
by kenmo
freak wrote: Thu Jan 29, 2026 9:52 pmThe problem is spreading this code as a "tip" around the forum, which will lead to people blindly using it thinking they are doing a clever optimization without understanding the details. And then if we do change something, we have to deal with the complaints again. And all that for an "optimization" that is not even worth that word.
Freak, I agree with all this you've said, about this workaround that ChrisR and fryquez discussed. But I think that's more reason for a native "UpdateStringLength" or "ResetStringLength" command. Even if it's just doing a PeekS() internally! Then it could be optimized in the future, or string lib internals could be reworked, automatic benefits for the user with zero changes to the user's code...
...
...
... also I think it makes code cleaner than unexplained
Var = PeekS(@Var) scattered around

Re: PureBasic 6.40 alpha 3 is ready, surprise inside !
Posted: Sun Feb 01, 2026 1:03 am
by ChrisR
Personally, I think it would be good to let us play with this prefix, but it would be better with an official guarantee in its integrity. Then, it's the developer's responsibility to know what they're doing
There is few points in its favor, in the last 2 post
here
I apologize in advance if I shouldn't, but someone sent me this macro recently, the fastest.
But the debate should not be about speed, PeekS is fast enough.
Code: Select all
CompilerIf #PB_Compiler_Version >= 640
Macro UpdateStringLength(String)
*string = @String : If *string : PokeI(*string - SizeOf(Integer), MemoryStringLength(*string)) : EndIf
EndMacro
CompilerElse
Macro UpdateStringLength(String)
;
EndMacro
CompilerEndIf