StringArray Sort (case independent)
-
- Posts: 284
- Joined: Mar 07, 2018 13:59
- Location: Germany
Re: StringArray Sort (case independent)
Ok - i see the problem now!
1.) Please use always the latest version (i just uploaded a new one).
2.) I ran exhaustive tests on 32 bit (at least i hope so), there are still some problems with 64 bit code (e.g accessing passed z/wstring arrays in 64 bit still causes a GPF). So please compile for 32 bit when testing.
3.) You must remove or outcomment the first two lines in "dodicat_sort.bas" because these are specific to my IDE and raise an error otherwise. This applies to all test files you find inside the "new" folder. My IDE can do PowerBASIC and FreeBASIC, therefore "compiler freebasic" means, compile using the FreeBASIC compiler. Likewise the #compile ..." statement, tells my IDE which settings to use for the FreeBASIC compiler.
4.) You cannot just compile from fbc_34.exe or fbc_64.exe! You must run fbc.exe in it´s regular environment. That is you must first rename fbc.exe, fbrt0.o, libfb.a and libfbmt.a or backup them, where they are located on your machine. Then you must copy fbc_32.exe to fbc.exe, where your original fbc.exe existed. Do the same with fbrt0.o, libfb.a and libfbmt.a (should be in the "lib" subfolder). Then copy "array.bi" and ustring.bi" to the "inc" subfolder.
Now you can compile and run FreeBASIC files as usual (but with the new binaries).
JK
1.) Please use always the latest version (i just uploaded a new one).
2.) I ran exhaustive tests on 32 bit (at least i hope so), there are still some problems with 64 bit code (e.g accessing passed z/wstring arrays in 64 bit still causes a GPF). So please compile for 32 bit when testing.
3.) You must remove or outcomment the first two lines in "dodicat_sort.bas" because these are specific to my IDE and raise an error otherwise. This applies to all test files you find inside the "new" folder. My IDE can do PowerBASIC and FreeBASIC, therefore "compiler freebasic" means, compile using the FreeBASIC compiler. Likewise the #compile ..." statement, tells my IDE which settings to use for the FreeBASIC compiler.
4.) You cannot just compile from fbc_34.exe or fbc_64.exe! You must run fbc.exe in it´s regular environment. That is you must first rename fbc.exe, fbrt0.o, libfb.a and libfbmt.a or backup them, where they are located on your machine. Then you must copy fbc_32.exe to fbc.exe, where your original fbc.exe existed. Do the same with fbrt0.o, libfb.a and libfbmt.a (should be in the "lib" subfolder). Then copy "array.bi" and ustring.bi" to the "inc" subfolder.
Now you can compile and run FreeBASIC files as usual (but with the new binaries).
JK
Re: StringArray Sort (case independent)
Thanks JK.
I'll start from fresh with a new fb and your latest build.
I'll start from fresh with a new fb and your latest build.
Re: StringArray Sort (case independent)
That sounds messy, even for FB standards. So it means you must ditch your old FreeBasic installation in favour of your version? And who guarantees that it does not break existing code? What happens if a new "official" FB version comes out?Juergen Kuehlwein wrote:4.) You cannot just compile from fbc_34.exe or fbc_64.exe! You must run fbc.exe in it´s regular environment. That is you must first rename fbc.exe, fbrt0.o, libfb.a and libfbmt.a or backup them, where they are located on your machine. Then you must copy fbc_32.exe to fbc.exe, where your original fbc.exe existed. Do the same with fbrt0.o, libfb.a and libfbmt.a (should be in the "lib" subfolder). Then copy "array.bi" and ustring.bi" to the "inc" subfolder.
Re: StringArray Sort (case independent)
This seems to me to indicate, that the priorities are "the wrong way around".Juergen Kuehlwein wrote:2.) I ran exhaustive tests on 32 bit (at least i hope so), there are still some problems with 64 bit code (e.g accessing passed z/wstring arrays in 64 bit still causes a GPF). So please compile for 32 bit when testing.
FBC 64 should be "top priority" all else, I'd consider "legacy" ...
-
- Posts: 284
- Joined: Mar 07, 2018 13:59
- Location: Germany
Re: StringArray Sort (case independent)
It´s just for testing, this is NOT in any way official. Therefore i recommended to make backup copies of the existing binaries in order to be able to restore it afterwards!
64 bit has a different data alignment than 32 bit, this is what i´m struggling with currently. There will be a working 64 bit version too!
JK
64 bit has a different data alignment than 32 bit, this is what i´m struggling with currently. There will be a working 64 bit version too!
JK
Re: StringArray Sort (case independent)
Yes, for everybody who regularly needs to allocate more than 2GB of memory.MrSwiss wrote:FBC 64 should be "top priority"
Re: StringArray Sort (case independent)
No, nothing to do with memory, far more "going with the Time",jj2007 wrote:Yes, for everybody who regularly needs to allocate more than 2GB of memory.
as opposed to "yesterday people" who are backwards oriented.
-
- Posts: 284
- Joined: Mar 07, 2018 13:59
- Location: Germany
Re: StringArray Sort (case independent)
Used to like that old song
https://www.youtube.com/watch?v=W6N3o4TDYsI
JK
Power basic.
Is this where you got those ideas of built in array functions?
What about recursive macros as well?
I think by inlining code in my quicksort it makes not a jot of difference to 64 bit with optimisations.
I think -O3 and -O2 and -O1 inline functions anyway.
All inline:
https://www.youtube.com/watch?v=W6N3o4TDYsI
JK
Power basic.
Is this where you got those ideas of built in array functions?
What about recursive macros as well?
I think by inlining code in my quicksort it makes not a jot of difference to 64 bit with optimisations.
I think -O3 and -O2 and -O1 inline functions anyway.
All inline:
Code: Select all
Dim Shared As String * 255 u
For n As Long=0 To 255
u[n]=Iif(n<91 Andalso n>64,n+32,n) 'lookup string
Next
Sub quicksortup(low As String Ptr,high As String Ptr)
If (high-low <= 1) Then Return
Var J=low+1,I=J,lenb=Cast(Integer Ptr,low)[1],lena=0
While J <= high
lena=Cast(Integer Ptr,J)[1] '=Len(*a)
If lena>lenb Then lena=lenb
For n As Long =0 To lena-1
If u[(J)[0][n]] < u[(low)[0][n]] Then Swap *J,*I:I+=1:Exit For
If u[(J)[0][n]] > u[(low)[0][n]] Then Exit For
Next
J+=1
Wend
J=I-1: Swap *low,*J
quicksortup(low,J)
quicksortup(I,high)
End Sub
Sub create(L() As String)
#define range(f,l) Int(Rnd*(((l)+1)-(f))+(f))
#define q range(97,122)-Iif(Rnd>.5,32,0)
Randomize 1
For n As Long=Lbound(L) To Ubound(L)
Dim As String g1=Chr(q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q)
Dim As String g2=Chr(q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q)
Dim As String g3=Chr(q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q)
L(n)=Left(g1+g2+g3,60+Rnd*30)
Next
End Sub
Sub show(L() As String)
For n As Long=Lbound(L) To 10
Print L(n)
Next
For n As Long=1 To 4
Print "..."
Next
For n As Long=Ubound(L)-10 To Ubound(L)
Print L(n)
Next
End Sub
Dim As Double t1,t2
Dim As Long limit=1000000
Dim As String L(1 To limit)
Print "Creating string"
create(L())
Print "Commence sort (quicksort)"
t1=Timer
quicksortup(@L(Lbound(L)),@L(Ubound(L)))
t2=Timer
show(L())
Print t2-t1;" Seconds quicksort"
Sleep
Re: StringArray Sort (case independent)
@dodicat,
seems to knock out the barrels bottom:
FBC 64 -gen gcc (no optimizer) = 1.25 Seconds
FBC 64 -gen gcc (-O 2) = 0.65 Seconds
Win10, pro, 64
CPU i7 (7th gen. ultra low power) 2 cores (4 threads) base speed: 2.9 GHz (variable)
seems to knock out the barrels bottom:
FBC 64 -gen gcc (no optimizer) = 1.25 Seconds
FBC 64 -gen gcc (-O 2) = 0.65 Seconds
Win10, pro, 64
CPU i7 (7th gen. ultra low power) 2 cores (4 threads) base speed: 2.9 GHz (variable)
Re: StringArray Sort (case independent)
I am fine-tuning my mergesort, now down to 0.6 seconds on a Core i5 ;-)
Re: StringArray Sort (case independent)
Win 10 64 bits.
Why does nm not work for 64 bit files
It shows the table of .o files only
e.g.
nm libfb_64.a
gives
Microsoft Windows [Version 10.0.18362.295]
(c) 2019 Microsoft Corporation. All rights reserved.
(then the path)
then
. . .
. . .
nm: array_sort.o: File format not recognized
nm: array_tmpdesc.o: File format not recognized
nm: array_ubound.o: File format not recognized
nm: con_input.o: File format not recognized
nm: con_lineinp.o: File format not recognized
nm: con_lineinp_wstr.o: File format not recognized
nm: con_locate.o: File format not recognized
nm: con_pos.o: File format not recognized
. . .
. . .
Is cmd.exe still stuck in 32 bits?
Why does nm not work for 64 bit files
It shows the table of .o files only
e.g.
nm libfb_64.a
gives
Microsoft Windows [Version 10.0.18362.295]
(c) 2019 Microsoft Corporation. All rights reserved.
(then the path)
then
. . .
. . .
nm: array_sort.o: File format not recognized
nm: array_tmpdesc.o: File format not recognized
nm: array_ubound.o: File format not recognized
nm: con_input.o: File format not recognized
nm: con_lineinp.o: File format not recognized
nm: con_lineinp_wstr.o: File format not recognized
nm: con_locate.o: File format not recognized
nm: con_pos.o: File format not recognized
. . .
. . .
Is cmd.exe still stuck in 32 bits?
Re: StringArray Sort (case independent)
Please people, stop hijacking this thread, for JK's array stuff (which has its own thread).
See: Community Discussion ... "New array features"
See: Community Discussion ... "New array features"
Re: StringArray Sort (case independent)
Well, JK has code that answers the OP's question. Looks very relevant. What do you offer, other than your "32-bit is obsolete" bla bla?
Re: StringArray Sort (case independent)
I am OP ... in case you've NOT noticed ...jj2007 wrote:Well, JK has code that answers the OP's question.