here it works - and tB becomes better and better![]()
OK, I could not resist!
It was like I expected.
Please find here attached a new thinCore.dll
Let me know if it works.
Ciao
Eros
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
here it works - and tB becomes better and better![]()
I think there are missing some Forum-sections as beta-testing and support
Hehe,
Eros at his bestGreat!
I have one suggestion regarding syntactic sugar. To keep in line with Dim..At, SetAt, GetAt...
What about changing the syntax of "ARRAY SCAN pointerToMemory PTR" to "ARRAY SCAN AT pointerToMemory"?
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Hi Petr, i think At is more like sign for an absolute variable while Array Scan myArray Ptr can be a real or some virtual array so At would be a little confusing while Ptr just tells Array Scan that its an array of pointers that point the data to scan.
The reason why you thought this might be because the above examples use as less real variables as necessary since they need time to Dim and allocate space. I'm convinced an overlay at some existing data is always the way to prefer when it comes to fast script execution
Last edited by ReneMiner; 11-09-2014 at 07:47.
I think there are missing some Forum-sections as beta-testing and support
Ciao Petr,
I thought about that but here "pointerToMemory" is not a pointer to memory but an array variable from which ARRAY SCAN detect array variable type an array number of elements without which it would be impossible to perform the scan. So I used PTR after array name to tell that DWORD array is a DWORD array of pointer allocated by HEAP_AllocByStr and not just other generic allocation method. Knowing that, I can use HEAP functionalities to detect real memory area and length of the allocated memory.
So ... It is a very specific ARRAY SCAN
Maybe I can add HEAP keyword in order to clarify it better. Something like ARRAY SCAN HEAP myDWordArray ...
Sent from my iPhone using Tapatalk
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Eros I think Ptr-keyword is fine just for this one usage here. It were something else if Heap would be a keyword already but since it's not i would refrain from adding a keyword here.
Last edited by ReneMiner; 11-09-2014 at 07:58.
I think there are missing some Forum-sections as beta-testing and support
some speedtest to compare the way i used before and now ... and i'm happy about the result,
now needs around 15% to 20% of the time it needed before to find a certain element:
#MinVersion 1.9.13.0 + new thinCore.dll ( attachement a few posts above )
(you may comment lines 30 & 47 to subtract the printing-time)Uses "console" ' heap-scan-speedtest Function TBMain() Local myPtr(&H4000) As DWord Local i, j As Long Local startingTime, neededTime As Quad Local sToFind As String Randomize HiResTimer_Init PrintL "filling in data now..." For i = 1 To UBound(myPtr) myPtr(i) = HEAP_AllocByStr("Mississippi" & Hex$(i,8)) Next ' - - - - - - - - - - - - - - - - - - - PrintL "do 255 scans the old way:" startingTime = HiResTimer_Get For i = 1 To 255 sToFind = Ucase$("mississippi" & Hex$(Rnd(1, UBound(myPtr)), 8)) For j = 1 To UBound(myPtr) If Ucase$(HEAP_Get(myPtr(j))) = sToFind Then Print "." ' <<< if comment this then <<< Exit For EndIf Next Next PrintL neededTime = HiResTimer_Get - startingtime PrintL "Time needed : " + Format$(neededTime / 1000000, "#.0000") PrintL $CRLF & Repeat$(42, "_") ' - - - - - - - - - - - - - - - - - - - PrintL "now 255 scans the new way:" startingTime = HiResTimer_Get For i = 1 To 255 sToFind = Ucase$("mississippi" & Hex$(Rnd(1, UBound(myPtr)), 8)) If Array Scan myPtr Ptr, Collate Ucase, = sToFind Then Print "." ' <<< comment this too <<< EndIf Next PrintL neededTime = HiResTimer_Get - startingtime PrintL "Time needed : " + Format$(neededTime / 1000000, "#.0000") ' - - - - - - - - - - - - - - - - - - - PrintL $CRLF & Repeat$(42, "*") PrintL $CRLF & "Any key to end" WaitKey End Function
Results may differ due randomized values to check for, but the felt average on my system = 1.0 / 5.5
Last edited by ReneMiner; 12-09-2014 at 10:58.
I think there are missing some Forum-sections as beta-testing and support
mmmmm
I'm not happy about this speed difference: from 3.3 sec to 0.6 is not enough![]()
I will see if I can improve it using your example.
![]()
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Dear Rene,
can you please check the attached new thinBasic Core engine and see new speed in ARRAY SCAN ... PTR ... ?
![]()
Last edited by ErosOlmi; 12-09-2014 at 22:48.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
when i tried out my current gui-project i discovered that tB instantly crashes on startup. i does not happen if i use the previous thincore-version.
Find array-scan-functions in unit-file GUI.tBasicU, all called like t_GUI.Enum...()
Last edited by ReneMiner; 13-09-2014 at 12:21.
I think there are missing some Forum-sections as beta-testing and support