Page 2 of 3

Re: PureBasic 6.40 alpha 1 is ready, surprise inside !

Posted: Fri Jan 23, 2026 2:48 pm
by GeoTrail
Fred wrote: Fri Jan 23, 2026 2:41 pm It's only the website which is wrong, the working link for alpha 1 is 'Download PureBasic 6.40 Beta 1 for Windows (x64)'. We usually don't do alpha so I won't change the website just for this time :)

@Skywalk: all should work (except the Purifier and some debugger stuff). The IDE is compiled with the 6.40 version, with threadsafe switch.
Yeah I figured that was the case. Always impressed with your dedication to Purebasic Fred 🥳

Re: PureBasic 6.40 alpha 1 is ready, surprise inside !

Posted: Fri Jan 23, 2026 3:30 pm
by threedslider
Thanks @Fred for clarity :mrgreen:

And your source code :
Fred wrote: Fri Jan 23, 2026 10:47 am

Code: Select all

Start = ElapsedMilliseconds()
a$ = "World WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld WorldWorld World"
For l = 0 To 1000
  b$ = b$ + a$ 
Next

PrintN("Final length = " + Str(Len(b$)))
PrintN("Large concat: "+Str(ElapsedMilliseconds() - Start) + " ms")
Only take my speed is 6ms !! Very impressive ! :shock:

Re: PureBasic 6.40 alpha 1 is ready, surprise inside !

Posted: Fri Jan 23, 2026 4:42 pm
by User_Russian
threedslider wrote: Fri Jan 23, 2026 3:30 pmOnly take my speed is 6ms !
If you disable the debugger, the time will be 40 milliseconds.

Re: PureBasic 6.40 alpha 1 is ready, surprise inside !

Posted: Fri Jan 23, 2026 4:54 pm
by minimy
Dont stop he!! :lol:
10000 Thanks or more Fred and team really good news!
It looks like you also have an army of elves at work :mrgreen:
Donwloading... :wink:

Re: PureBasic 6.40 alpha 1 is ready, surprise inside !

Posted: Fri Jan 23, 2026 5:34 pm
by SMaag
At 1st congratulation to this desiccion!

I do a lot of crazy String manipulations what will probably fail with the new String System.

So I have some questions about it works under the hood:

1. Where the length information is saved?
2. How to read out directly?
3. And finally how to manipulate directly?
4. Do we have a length information of the allocated buffer too? (would be very helpful!)

Re: PureBasic 6.40 alpha 1 is ready, surprise inside !

Posted: Fri Jan 23, 2026 8:15 pm
by SMaag
Amazing! If you did not manuiplate the ElapsedMilliseconds()!!!

I can't belive that the speed plus is only the change of String library.

I use prototyped String functions to prevent PB from creating string copies.

I'm working on a X-Reference Tool with a lot of Character and String functions.
(it's very early ProofOfConcept implementation because of that I can't say what is the correct result)

here the result for PB 6.30
PB V6.30 : ASM-Backend
No of Codelines = 59368
Time to parse ms = 87
Total amount of Words = 91298
Different Words found = 14378

PB V6.30 : C-Backend
No of Codelines = 59368
Time to parse ms = 90
Total amount of Words = 91285
Different Words found = 14374
Result for PB6.40
PB V6.40 : C-Backend
No of Codelines = 59368
Time to parse ms = 56
Total amount of Words = 83622
Different Words found = 14379

PB V6.40 : C-Backend
No of Codelines = 59368
Time to parse ms = 57
Total amount of Words = 83606
Different Words found = 14379

PB V6.40 : C-Backend
No of Codelines = 59368
Time to parse ms = 58
Total amount of Words = 83630
Different Words found = 14384

Surprising: in 6.30 the Result form ASM to C-Backend differ in NoOfWords found

in PB6.40 the result differ in each attempt!

But Speed+ is amazing 90ms->57m +37%

Can't post the Code at the moment. It's a Project of some modules. I try to make Demo Project an upload it on GitHub

Re: PureBasic 6.40 alpha 1 is ready, surprise inside !

Posted: Fri Jan 23, 2026 8:45 pm
by ChrisR
It's a real surprise, it was expected.
Thanks a lot for your courage to take over the strings management after 30 years of loyal service.
With C Optimizer my times are PB 6.30 = 92 ms, PB 6.40 alpa 1 = 6 ms, waouh
I tested it with ExString to see if it was nearing the end of its life but not yet: 1 ms :wink:

Re: PureBasic 6.40 alpha 1 is ready, surprise inside !

Posted: Fri Jan 23, 2026 8:46 pm
by marcoagpinto
@Fred,

Thank you!

<3 <3 <3 <3 <3 <3 <3 <3

Re: PureBasic 6.40 alpha 1 is ready, surprise inside !

Posted: Fri Jan 23, 2026 9:23 pm
by threedslider
Thanks to @SMaag for testing in speed :mrgreen:

Thanks to @ChrisR to you as well for testing :shock:

Re: PureBasic 6.40 alpha 1 is ready, surprise inside !

Posted: Fri Jan 23, 2026 10:40 pm
by mk-soft
Hello Fred,
Is it also possible to correct the string length for API without memory leakage.

Code: Select all

;-TOP by mk-soft

Structure pb_string
  len.i
  c.c[0]
EndStructure

Procedure _FixStringLen(*string)
  Protected i, *mem.pb_string
  
  If *string
    *mem = *string - SizeOf(pb_string)
    Repeat
      If *mem\c[i] = 0
        *mem\len = i
        Break
      EndIf
      i + 1
    ForEver
  EndIf
EndProcedure

Macro FixStringLen(String)
  _FixStringLen(@String)
EndMacro

PureBasicPath$ = Space(#MAX_PATH)
GetModuleFileName_(GetModuleHandle_(#Null$), @PureBasicPath$, #MAX_PATH)
;PureBasicPath$ = PeekS(@PureBasicPath$)
FixStringLen(PureBasicPath$)
PureBasicPath$ = GetPathPart(PureBasicPath$)
Debug PureBasicPath$

Re: PureBasic 6.40 alpha 1 is ready, surprise inside !

Posted: Fri Jan 23, 2026 11:20 pm
by idle
That's great news you're tackling strings, is the new allocator being used system wide?

Re: PureBasic 6.40 alpha 1 is ready, surprise inside !

Posted: Fri Jan 23, 2026 11:59 pm
by kenmo
Very interesting surprise, thanks. Looking forward to testing it when there's a Linux build. (No rush! 8) )

Re: PureBasic 6.40 alpha 1 is ready, surprise inside !

Posted: Sat Jan 24, 2026 3:19 am
by BarryG
Fred wrote:if you patch a string by putting a zero in it, the Len() function will be wrong, and the concat functions will fail. You will need to use PeekS() for this.
What do you mean by putting a zero? Strings can't contain Chr(0) so I don't understand. Or did you mean zero as in Chr(48)?
Fred wrote:Using Win32 API with Space() for example will require an extra PeekS().
Not sure what this means, either. I do this in my app, so are you saying I can't do this anymore without PeekS() now?

Code: Select all

cap$=Space(999) : GetWindowText_(hWnd,cap$,999)

Re: PureBasic 6.40 alpha 1 is ready, surprise inside !

Posted: Sat Jan 24, 2026 4:46 am
by skywalk
I think Fred's referring to the old way to split a string by replacing the token or delimiter with a \0.
The PeekS() may be more api compatible now than the Space() function which has a leading byte of len info?

Re: PureBasic 6.40 alpha 1 is ready, surprise inside !

Posted: Sat Jan 24, 2026 12:06 pm
by freak
BarryG wrote: Sat Jan 24, 2026 3:19 am
Fred wrote:Using Win32 API with Space() for example will require an extra PeekS().
Not sure what this means, either. I do this in my app, so are you saying I can't do this anymore without PeekS() now?

Code: Select all

cap$=Space(999) : GetWindowText_(hWnd,cap$,999)
Just like this:

Code: Select all

cap$=Space(999) : GetWindowText_(hWnd,cap$,999) : cap$ = PeekS(cap$)
The PeekS() will update the internally stored string length to match what has been put there by GetWindowText_(). Without it, PB will keep thinking that the string has 999 characters.