PureBasic 6.40 alpha 1 is ready, surprise inside !

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
GeoTrail
Addict
Addict
Posts: 2799
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

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

Post 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 🥳
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
threedslider
Enthusiast
Enthusiast
Posts: 547
Joined: Sat Feb 12, 2022 7:15 pm

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

Post 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:
User_Russian
Addict
Addict
Posts: 1614
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

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

Post 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.
User avatar
minimy
Addict
Addict
Posts: 839
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

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

Post 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:
If translation=Error: reply="Sorry, Im Spanish": Endif
SMaag
Enthusiast
Enthusiast
Posts: 364
Joined: Sat Jan 14, 2023 6:55 pm
Location: Bavaria/Germany

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

Post 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!)
SMaag
Enthusiast
Enthusiast
Posts: 364
Joined: Sat Jan 14, 2023 6:55 pm
Location: Bavaria/Germany

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

Post 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
Last edited by SMaag on Fri Jan 23, 2026 8:47 pm, edited 2 times in total.
User avatar
ChrisR
Addict
Addict
Posts: 1544
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

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

Post 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:
Last edited by ChrisR on Fri Jan 23, 2026 8:46 pm, edited 1 time in total.
User avatar
marcoagpinto
Addict
Addict
Posts: 1087
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

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

Post by marcoagpinto »

@Fred,

Thank you!

<3 <3 <3 <3 <3 <3 <3 <3
threedslider
Enthusiast
Enthusiast
Posts: 547
Joined: Sat Feb 12, 2022 7:15 pm

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

Post by threedslider »

Thanks to @SMaag for testing in speed :mrgreen:

Thanks to @ChrisR to you as well for testing :shock:
User avatar
mk-soft
Always Here
Always Here
Posts: 6510
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

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

Post 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$
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
idle
Always Here
Always Here
Posts: 6168
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

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

Post by idle »

That's great news you're tackling strings, is the new allocator being used system wide?
User avatar
kenmo
Addict
Addict
Posts: 2078
Joined: Tue Dec 23, 2003 3:54 am

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

Post by kenmo »

Very interesting surprise, thanks. Looking forward to testing it when there's a Linux build. (No rush! 8) )
BarryG
Addict
Addict
Posts: 4312
Joined: Thu Apr 18, 2019 8:17 am

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

Post 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)
User avatar
skywalk
Addict
Addict
Posts: 4287
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

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

Post 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?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
freak
PureBasic Team
PureBasic Team
Posts: 5954
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

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

Post 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.
quidquid Latine dictum sit altum videtur
Post Reply