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
If p Then pc = pc + 1
MsgBox pc & " " & (GetTickCount - gtc) / 1000 & " sec VISUALBASIC6"
Here are my new results for FBSL, VB6 IDE, and VB6 compiled to native code:
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!