FBSL, thinBasic & AutoIt3 Comparative Benchmarks

(Vital Data and New Beta Release Info)

Re: FBSL, thinBasic & AutoIt3 Comparative Benchmarks

Unread postby Mike Lobanovsky » Tue Nov 25, 2014 6:22 pm

Hi Oleg,

Welcome to the forum! :)

Yes, you are perfectly correct. My VB6 declarations left n and k declared as Variants, which slowed down the application in both interpretative and native code modes of execution. The new script fixed as below yields much better results on my current PC:

Code: Select all
Attribute VB_Name = "VBIntBench"
Declare Function GetTickCount Lib "kernel32.dll" () As Long

Sub Main() ' VB6 // 9.453  1.343 <= Uncompiled, compiled; 3.2GHz i5 Core Quad
    Dim n As Long, lim As Long
    Dim k As Long, p  As Long
    Dim pc  As Long
    Dim gtc As Long
   
    pc = 0
    n = 1
    lim = 5000000
   
    gtc = GetTickCount()
    While n < lim
        k = 3
        p = 1
        n = n + 2
        While k * k <= n And p
            p = (n \ k) * k <> n ' precedence!
            k = k + 2
        Wend
        If p Then pc = pc + 1
    Wend
    MsgBox pc & " " & (GetTickCount - gtc) / 1000 & " sec VISUALBASIC6"
End Sub


Here are my new results for FBSL, VB6 IDE, and VB6 compiled to native code:

IntMandel_i5.PNG
IntMandel_i5.PNG (13.24 KiB) Viewed 969 times

As for the LangMF results, I would like to inform you that the next generation FBSL - version 3.75 - will have its BASIC code JIT-compiled to machine code at app start as well, similar to the existing DynC and DynAsm. With this new functionality implemented, the speed of BASIC code will increase 120 times on the average and there will be no sense in comparing FBSL with LangMF any more.

Nonetheless, thanks again for pointing out my flaws and also for the new information on LangMF capabilities.


Enjoy your stay with FBSL! :)
Mike
"Я старый солдат, мадам, и не знаю слов любви."
"I am an old soldier, ma'am, and I don't know the words of love."
"Je suis un vieux soldat, madame, et je ne connais pas les mots d'amour."
"Ich bin ein alter Soldat, gnädige Frau, und ich weiß nicht die Worte der Liebe."

__________________________________________________________________________________________________________________________________________________
(3.2GHz i5 Core Quad, 8GB RAM / 2 x nVidia GTX 550Ti SLI-bridged, 2GB VRAM)
(x86 Win XP Pro Russian Sp3/x86 Win Vista Ultimate Sp2/x64 Win 7 Ultimate Sp1/Wine in x64 elementaryOS Luna)
User avatar
Mike Lobanovsky
FBSL Administrator
FBSL Administrator
 
Posts: 1823
Joined: Tue Apr 19, 2005 8:22 am
Location: Republic of Belarus

Re: FBSL, thinBasic & AutoIt3 Comparative Benchmarks

Unread postby Codeman » Tue Nov 25, 2014 7:01 pm

isn't there a problem with dynasm here mike ? how could it be slower than dync ?
_-=<(¯`·._.·[ CodeMan ]·._.·´¯)>=-_
Your only limit : Your imagination

FBSL V3 TESTED On :
Image

Chris 1 (Corei5-4460S 2.9 GHZ w/ 16GB RAM, GeForce GTX 745 w/ 4GB VRAM, Windows 8 x64 Fr)
Chris 2 (2.0GHz AMD Atlon 64 X2 3800+ w/ 4GB RAM, GeForce 9600GT w/ 1GB VRAM, Windows 7 x64 Fr)
Chris 3 (Tablet pc : ASUS Transformer Book T100)
User avatar
Codeman
FBSL Administrator
FBSL Administrator
 
Posts: 497
Joined: Sat Nov 24, 2007 4:33 pm
Location: France

Re: FBSL, thinBasic & AutoIt3 Comparative Benchmarks

Unread postby Mike Lobanovsky » Tue Nov 25, 2014 10:47 pm

In fact no problem and no wonder here, Chris. DynC unrolls machine code loops and also aligns code labels on machine-word (4-byte) boundaries automatically. DynAsm doesn't do it unless you code it that way specifically by hand. I didn't code it that way to keep the sources absolutely identical in all the three languages:

Code: Select all
................................

Function %Prime()
   Dim pc = 0, n = 1, lim = 5000000
   Dim k = 0, p = 0
   
   While n < lim
      k = 3: p = 1
      n = n + 2
      While k * k <= n And p
         p = (n \ k) * k <> n // precedence!
         k = k + 2
      WEnd
      If p Then pc = pc + 1
   WEnd
   Return pc
End Function

DynC %PrimeC()
   int main() {
      int pc = 0, n = 1, lim = 5000000;
      int k, p;
      
      while (n < lim) {
         k = 3; p = 1;
         n = n + 2;
         while (k * k <= n && p) {
            p = n / k * k != n;
            k = k + 2;
         }
         if (p) pc = pc + 1;
      }
      return pc;
   }
End DynC

DynAsm %PrimeA()
   #Define FALSE 0
   #Define TRUE 1
   #Define pc DWORD PTR [ebp - 4]
   #Define lim ebx
   #Define n ecx
   #Define k esi
   #Define p edi
   
   enter 4, 0
   push ebx
   push esi
   push edi
   
   mov pc, 0
   mov n, 1
   mov lim, 5000000
   
   .While n < lim
      
      mov k, 3
      mov p, 1
      add n, 2
      
      @@ // inner While
      mov eax, k
      mul k
      .If eax > n .Then
         jmp @F
      .EndIf
      .If p = FALSE .Then
         jmp @F
      .EndIf
      
      mov eax, n
      xor edx, edx // must clear before integer division
      div k
      mul k
      mov p, FALSE
      .If eax <> n .Then
         mov p, TRUE
      .EndIf
      add k, 2
      jmp @B // inner WEnd
      
      @@ // incrementation
      .If p .Then
         add pc, 1
      .EndIf
      
   .WEnd
   
   mov eax, pc
   
   pop edi
   pop esi
   pop ebx
   leave
   
   ret
End DynAsm
Mike
"Я старый солдат, мадам, и не знаю слов любви."
"I am an old soldier, ma'am, and I don't know the words of love."
"Je suis un vieux soldat, madame, et je ne connais pas les mots d'amour."
"Ich bin ein alter Soldat, gnädige Frau, und ich weiß nicht die Worte der Liebe."

__________________________________________________________________________________________________________________________________________________
(3.2GHz i5 Core Quad, 8GB RAM / 2 x nVidia GTX 550Ti SLI-bridged, 2GB VRAM)
(x86 Win XP Pro Russian Sp3/x86 Win Vista Ultimate Sp2/x64 Win 7 Ultimate Sp1/Wine in x64 elementaryOS Luna)
User avatar
Mike Lobanovsky
FBSL Administrator
FBSL Administrator
 
Posts: 1823
Joined: Tue Apr 19, 2005 8:22 am
Location: Republic of Belarus

Previous

Return to FBSL v3 News

Who is online

Users browsing this forum: No registered users and 1 guest