|
Post by yyin on Jan 16, 2022 3:58:55 GMT 1
|
|
|
Post by scalion on Jan 16, 2022 13:48:22 GMT 1
Hi yyin, Our Peter had already answered:
17 years later, It would indeed be interesting to redo a benchmark of the various current basics.
|
|
|
Post by yyin on Jan 16, 2022 15:05:24 GMT 1
Hi yyin, Our Peter had already answered: 17 years later, It would indeed be interesting to redo a benchmark of the various current basics.
Hi....your idea is so good. There are so many BASIC languages. An objective speed test may be very useful because the result may show that GFA BASIC is a very fast BASIC language among all BASIC languages. Finally, many people may become GFA BASIC users because of this result. But we need to find people who are familiar with various BASIC languages to do the test. Not too easy.
|
|
|
Post by Xavier on Jan 16, 2022 15:20:36 GMT 1
The most significant question for speed is: "Does your programming language compile (fast execution) or interpret (slow execution)?" GFA-BASIC 32 for Windows compiles your code.
You get a fast executable file to run.
i.e.: My_Progam.exe
|
|
|
Post by Xavier on Jan 16, 2022 15:26:09 GMT 1
The second most important consideration - which has little to do with the programming language - is: "Can your program execution be done faster by changing the algorithm, data types etc?" This mostly depends on the programmer.
For example: If you declare a variable with the optional key word REGISTER, then it will use 'register memory' which executes perhaps 4 times faster! So why is it optional? Why aren't all variables declared this way automatically? I am not sure. These are the finer points of computers that I am still learning about.
|
|
|
Post by Xavier on Jan 16, 2022 18:11:17 GMT 1
But we need to find people who are familiar with various BASIC languages to do the test. Not too easy.
I have to admit I am curious.
We need people that are as proud of their programming platform as Lando is of the Millenium Falcon...
|
|
|
Post by Xavier on Jan 16, 2022 23:41:10 GMT 1
Here is quick benchmark test that counts to 1 Gig.( We can't compare the results of the video because we don't know what PC they were using, but, it shows C++ taking 3.5 seconds, while others taking minutes.)
' ' A simple comparison of variable defined "As Register" or not. ' OpenW 1 Dim t#, dt#, n%
Local a1 As Register Long t = Timer a1 = 0 While (a1 < 1000000000) a1++ Loop
dt = Timer - t Print "Time for a1 to count to 1Gig?"; dt; "s"
Local a2 As Long t = Timer a2 = 0 While (a2 < 1000000000) a2++ Loop
dt = Timer - t Print "Time for a2 to count to 1Gig?"; dt; "s"
Print "Press any key to exit." KeyGet n
CloseW 1
Results as run from the GFA Editor vs Running the compiled (exe) version...
|
|
|
Post by yyin on Jan 17, 2022 4:21:19 GMT 1
Here is quick benchmark test that counts to 1 Gig. This video shows some results of other languages: www.youtube.com/watch?v=b4IKJaXzwm8 ( We can't compare the results of the video because we don't know what PC they were using, but, it shows C++ taking 3.5 seconds, while others taking minutes.)
The test looks nice. The result from the video: Java 8: 0.36 seconds C: 1.95 seconds C++: 3.5 seconds Lua 5.3: 1 min. 4 seconds Yulia Lang 0.7.0 dev: 1 min. 40 seconds Python 3: 2 min. 43 seconds Python is the slowest software. Wow! I don't have sufficient programming knowledge to understand all things mentioned by you. However, very interesting! My computer has a problem. GFA Basic cannot be run normally on this computer. I will look into the problem. On the other hand, your test result is interesting. Will you try to test other BASICs later? Which BASICs? Test which BASIC first? After the whole test is completed, if the result is announced in other places, those people may focus on GFA BASIC.
|
|
|
Post by yyin on Jan 17, 2022 4:23:08 GMT 1
But we need to find people who are familiar with various BASIC languages to do the test. Not too easy. I have to admit I am curious. Curiosity is a good thing. Research has shown curiosity to be associated with higher levels of positive emotions, lower levels of anxiety, more satisfaction with life, and greater psychological well-being.
|
|
|
Post by Xavier on Jan 17, 2022 4:54:15 GMT 1
GFA Basic cannot be run normally on this computer.
What is the situation?
|
|
|
Post by larrybtoys on Jan 17, 2022 13:32:10 GMT 1
This is the program running on my PC, Editor and Compiled Attachments:
|
|
|
Post by jj2007 on Jan 17, 2022 18:47:50 GMT 1
That's an empty loop, hardly a meaningful benchmark:
t = Timer a1 = 0 While (a1 < 1000000000) a1++ Loop
dt = Timer - t Print "Time for a1 to count to 1Gig?"; dt; "s"
What about something more complex? - load a fat text file, e.g. "bible.txt" (about 4MB) - sort it - add line numbers to each line - replace every occurrence of "devil" with "satan" - store file to disk
|
|
|
Post by Xavier on Jan 17, 2022 18:49:15 GMT 1
Go for it!
|
|
|
Post by jj2007 on Jan 18, 2022 2:23:42 GMT 1
What happened to GfaBasic16's Recall command?
I put a test text here. It's a 4397206 bytes text file (don't ask where it came from - I've forgotten).
The task: - load a fat text file, e.g. "bible.txt" (about 4MB) - sort it - add line numbers to each line - replace every occurrence of "devil" with "Satan" (can be Devil or devil but not devilish) - store file to disk First test with another Basic dialect:
include \masm32\MasmBasic\MasmBasic.inc Init PrintCpu 0 ; show the CPU (otherwise no comparability...) For_ ct=0 To 9 NanoTimer() ; start timing Recall "Bible.txt", my$() ; load file into an array of strings QSort my$() ; sort the array For_ ecx=0 To eax-1 ; QSort returns #lines in eax Let my$(ecx)=Str$("Line %i\t", ecx)+my$(ecx) ; add line number .if Instr_(eax, "devil", 1+4) ; if line contains "devil" (mode case-insensitive, full word) Let my$(ecx)=Replace$(my$(ecx), "devil", "Satan", 1+4) ; then replace with Satan .endif Next Store "ModifiedBible.txt", my$() ; store the array to disk PrintLine Str$("Processing %i lines took ", eax), NanoTimer$() ; display time needed Next EndOfCode
Output:
Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz Processing 33979 lines took 42 ms Processing 33979 lines took 49 ms Processing 33979 lines took 48 ms Processing 33979 lines took 45 ms Processing 33979 lines took 47 ms Processing 33979 lines took 45 ms Processing 33979 lines took 43 ms Processing 33979 lines took 46 ms Processing 33979 lines took 47 ms Processing 33979 lines took 45 ms I'd love to see how GB32 performs on this - any volunteers? I just downloaded GB32, and it seems I'll need some time to learn it. Where is the manual btw?
|
|
|
Post by Xavier on Jan 18, 2022 3:38:01 GMT 1
You may not know, but, I am wondering...
Is My$() a dynamic array? Where is My$() defined? Why this number? 33979 (0x84BB)
|
|
|
Post by jj2007 on Jan 18, 2022 3:49:47 GMT 1
Is My$() a dynamic array? YES Where is My$() defined? Defined by the Recall command Why this number? 33979 (0x84BB) The original file has 33979 lines; Store, Recall and QSort leave the number of lines in the eax register.
|
|
|
Post by Xavier on Jan 18, 2022 5:22:42 GMT 1
Here are the preliminary results for GFA-BASIC 32 compiled code :
For: Intel(R) Core(TM) i3-3110M CPU @ 2.40GHz, 64-bit operating system, x64-based processor
OpenW 1 Local a(33979) As String, i%, j As Long, n As Long, t# For i = 0 To 9 Open "Bible.txt" for Input As # 1 Open "ModifiedBible.txt" for Output As # 2 t = Timer Recall # 1, a(), -1, n QSort a() For j = 0 To n - 1 a(j) = "Line " & Str(j) & #9 & a(j) reSub a(j), "devil", "Satan" // then replace with Satan Next j Store # 2, a() Print "Sorted "; n; " lines in"; Timer - t; "seconds." Close # 2 Close # 1 Next i KeyGet n CloseW 1
|
|
|
Post by yyin on Jan 18, 2022 8:42:09 GMT 1
What about something more complex? - load a fat text file, e.g. "bible.txt" (about 4MB) - sort it - add line numbers to each line - replace every occurrence of "devil" with "satan" - store file to disk Wow! So complicated! I don't have sufficient knowledge to accomplish these tasks. Well done!!!
|
|
|
Post by yyin on Jan 18, 2022 8:59:46 GMT 1
Here are the preliminary results for GFA-BASIC 32 compiled code :
For: Intel(R) Core(TM) i3-3110M CPU @ 2.40GHz, 64-bit operating system, x64-based processor
OpenW 1 Local a(33979) As String, i%, j As Long, n As Long, t# For i = 0 To 9 Open "Bible.txt" for Input As # 1 Open "ModifiedBible.txt" for Output As # 2 t = Timer Recall # 1, a(), -1, n QSort a() For j = 0 To n - 1 a(j) = "Line " & Str(j) & #9 & a(j) reSub a(j), "devil", "Satan" // then replace with Satan Next j Store # 2, a() Print "Sorted "; n; " lines in"; Timer - t; "seconds." Close # 2 Close # 1 Next i KeyGet n CloseW 1
<button disabled="" class="c-attachment-insert--linked o-btn--sm">Attachment Deleted</button>
But which one is faster? MasmBasic or GFA-BASIC 32? I don't understand.
|
|
|
Post by yyin on Jan 18, 2022 9:15:52 GMT 1
GFA Basic cannot be run normally on this computer.
What is the situation?
Hi...GFA BASIC can't generate any EXE file on this computer. In fact, this computer always has different types of problems. But don't worry. Two desktop computers and four laptop computers are in my house. I will try to run GFA BASIC on these computers later. Since I am busy at the moment, I can't try GFA BASIC on these computers now. The speed test is a very interesting experiment! I hope that the speed test can include those free BASICs. (For example, FreeBASIC.)
|
|
|
Post by larrybtoys on Jan 18, 2022 13:30:51 GMT 1
Here are my results on a 6th Gen i7 with an SSD. This was the compiled version of the program. Attachments:
|
|
|
Post by Xavier on Jan 18, 2022 15:09:25 GMT 1
But which one is faster? MasmBasic or GFA-BASIC 32? I don't understand.
At first blush, GFA and MASM are very close. *
* Of course the GFA and MASM code should be run on the same machine for a direct comparison.
In terms of processors, the i6 returned very similar results to the i5, but, the i3 was off by about 100 ms which is still faster than the blink of an eye.
|
|
|
Post by Xavier on Jan 18, 2022 16:03:18 GMT 1
This version averages the results and rounds to 3 decimal places.
' ??? i7 with an SSD avg: ~0.05 s ' MS Surface... i5-8250U CPU @ 1.60GHz avg: 0.096 s ' L430 laptop... i3-3110M CPU @ 2.40GHz avg: 0.139 s ' OpenW 1 Print App.Name Print Local a(33979) As String, i%, j As Long, n As Long, t#, dt#(10), dt_avg# For i = 0 To 9 Open "Bible.txt" for Input As # 1 Open "ModifiedBible.txt" for Output As # 2 t = Timer Recall # 1, a(), -1, n QSort a() For j = 0 To n - 1 a(j) = "Line " & Str(j) & #9 & a(j) reSub a(j), "devil", "Satan" Next j Store # 2, a() Close # 2 Close # 1 dt(i) = Timer - t Print "dt(" & i & ")="; Format(dt(i), "0.##0 "); " s" dt_avg += dt(i) / 10 Next i Print Print "Sorted "; n; " lines, 10 times for an avegage of "; Format(dt_avg, "0.##0 "); "s." KeyGet n CloseW 1
|
|
|
Post by jj2007 on Jan 18, 2022 16:39:42 GMT 1
Excellent, (X)! And thanks for confirming that Recall, QSort and Store still exist in GfaBasic32 ;-)
MasmBasic QSort yields slightly different results, but that's only a matter of taste (empty lines suppressed, th before Ti): Line 0 # It was written to the Philippians from Rome by Epaphroditus. Line 1 # It was written to Titus, ordained the first bishop of the church of the Cretians, from Nicopolis of Macedonia. GfaBasic32 (1340 empty lines first, then Ti before th, i.e. the sort is case-sensitive; no full word mode, see line 8840, satanish):
Line 0 Line 1 ... Line 1340 Line 1341 # It was written to Titus, ordained the first bishop of the church of the Cretians, from Nicopolis of Macedonia. Line 1342 # It was written to the Philippians from Rome by Epaphroditus.
Btw this is about 7% faster, because few lines contain the word:
If InStr(a(j), "devil", 1) reSub a(j), "devil", "Satan" EndIf
What's next? Any ideas for a slow common task? Sorting a large text or numeric array maybe? That can take a while. Once I made a comparison between M$ Excel and LibreOffice, and the damn Micros*t product sorted the table 10 times faster...
Attachments:
|
|
|
Post by Xavier on Jan 18, 2022 16:58:03 GMT 1
The speed test is a very interesting experiment! I hope that the speed test can include those free BASICs. (For example, FreeBASIC.)
When all is said and done, for me, GFA is better than OK in terms of speed.
But, even if GFA is still evolving and improving, you can easily find platforms that are better and improving faster.
Constantly searching for the next best thing is probably something that is expected of professional developers eager to get ahead of the competition.
As a hobbiest, so far, I am 'happy' with GFA's progress, advantages and limitations.
I still feel compelled and often impressed to see what I can create using GFA.
Maybe I am just too easy to impress and easy to please, but, I am definitely having fun.
|
|
|
Post by jj2007 on Jan 18, 2022 18:48:38 GMT 1
I am definitly having funThat's what counts Here is another one, Reading doubles from an array ( executable here): include \masm32\MasmBasic\MasmBasic.inc SetGlobals REAL8 min8, max8 Init PrintCpu 0 elements=10000000 ; ten Million elements Dim MyReal8() As REAL8 For_ ct=0 To 19 .if !Exist("MyReals.dat") || ct<10 NanoTimer() For_ ecx=0 To elements-1 Rand(-100, 100, MyReal8(ecx)) Next PrintLine Str$("Creating an array of %i random doubles took ", ecx), NanoTimer$() If_ ct==0 Then ArrayStore "MyReals.dat", MyReal8() .else NanoTimer() ArrayRead MyReal8(), "MyReals.dat" ArrayMinMax MyReal8(), min8, max8 PrintLine Str$("Reading and getting min=%7f", min8), Str$(" and max=%8f took ", max8), NanoTimer$() .endif Next EndOfCode Output: Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz Creating an array of 10000000 random doubles took 396 ms Creating an array of 10000000 random doubles took 184 ms Creating an array of 10000000 random doubles took 177 ms Creating an array of 10000000 random doubles took 183 ms Creating an array of 10000000 random doubles took 180 ms Creating an array of 10000000 random doubles took 171 ms Creating an array of 10000000 random doubles took 165 ms Creating an array of 10000000 random doubles took 172 ms Creating an array of 10000000 random doubles took 177 ms Creating an array of 10000000 random doubles took 170 ms Reading and getting min=-99.99998 and max=99.999996 took 136 ms Reading and getting min=-99.99998 and max=99.999996 took 207 ms Reading and getting min=-99.99998 and max=99.999996 took 576 ms Reading and getting min=-99.99998 and max=99.999996 took 131 ms Reading and getting min=-99.99998 and max=99.999996 took 133 ms Reading and getting min=-99.99998 and max=99.999996 took 134 ms Reading and getting min=-99.99998 and max=99.999996 took 133 ms Reading and getting min=-99.99998 and max=99.999996 took 131 ms Reading and getting min=-99.99998 and max=99.999996 took 174 ms Reading and getting min=-99.99998 and max=99.999996 took 136 ms
|
|
|
Post by Xavier on Jan 18, 2022 19:10:02 GMT 1
* Thanks, but, whenever possible, as a precaution, I'll only run executables that I have compiled from source code.
|
|
|
Post by jj2007 on Jan 18, 2022 19:54:25 GMT 1
* Thanks, but, whenever possible, as a precaution, I'll only run executables that I have compiled from source code.
That's a wise strategy. I could point you to the " how to install MasmBasic" page, but there are more executables waiting... If you post the GfaBasic32 equivalent, I can do the timings on my machine.
|
|
|
Post by larrybtoys on Jan 18, 2022 22:26:55 GMT 1
That is wise indeed however I keep a spare i5 laptop handy that I run all unknown programs on until I know they are safe. If it ever gets scrambled I just throw a new image on it and it's back to perfect again.
|
|
|
Post by yyin on Jan 20, 2022 11:18:09 GMT 1
That is wise indeed however I keep a spare i5 laptop handy that I run all unknown programs on until I know they are safe. If it ever gets scrambled I just throw a new image on it and it's back to perfect again. Good!!!
|
|