Running speed test with different methods
(a=* or activex.dll>> class1.a=*)
Test result reference
:
activex.dll(class1.A=**) About 10 times slower
(Compared with dim a as long)
Now I still need to compare with (stand dll). I hope some interested friends can try it
'比较结果:com dll(activex dll)方式赋值比直接定义的变量慢10几倍。
'现在还需要(activex dll)和(标准dll)的调用过程相比较,看看哪个速度更快,希望有兴趣的朋友来试下
'=========================
BasFile_Public_A=I used: 16.727 MS
ClassA.A =125.8725 MS
ActiveXDll.Class2.A =125.5622 MS
ClassA.MethedSetB( sub) =352.0073 MS
ActiveXExe3.Class1.A =500655.7859 MS
'Instancing=GlobalMultiUse
'Independent mode=独立方式
ActiveXExe5.Class1.A =11377.7648 MS
ActiveXExe.Class1.MethedSetB(SUB)=11377.7648 MS
'=========================
用不同的方法进行运行速度测试
'author: xiaoyaocode#163.com
'qq: 2776478814 (chinese)
'Copyright: you can distribute it freely, but please keep the relevant author information
'Note: please turn off compilation optimization and set the power option to "high performance"
'版权:你可以任意分发,但请保留相关作者信息
'注意:请关闭编绎优化,电源选项设置为“高性能”
'=========================
'set speed for :
dim a as long
for i=1 to 100000000
a=i
'Class1.A=I
'activexDLL.a=i
'ocx.a=i
'activexExe.a=i
'CALL SUB SetAvalue(byval v as long)
'or test getval: function Getvalue(arg1 as long)
next
'=========================
Compile all *.vbp(project)
Reference all dll and activex*.exe to "#project1.vbp"
Compile #project1.vbp
run #project1.exe
'=========================
you also can mak a Activex.dll for test by vc++ (vb.net,c#)
you also can mak a stand dll for test
method API:sub Setval(byval a as long)
Programing language:vc++,freebasic
'=========================
Test Begin:wait ****
20-1-29 19:00:32 -- TestTimes=10000000
19:00:32 -- BasFile_Publicc_A =16.7993 MS
19:00:33 -- Form_Puba =21.8567 MS
19:00:33 -- ClassA.A =127.4176 MS
19:00:33 -- ClassA.MethedSetB( sub) =340.2051 MS
19:00:33 -- ActiveXDll.Class1.MethedSetB(sub) =342.6474 MS
19:00:37 -- OCX.A =3566.1195 MS
19:00:40 -- OCX.MethedSetB(sub) =3475.3528 MS
19:00:44 -- UserControl2.A =3588.8008 MS
19:00:48 -- UserControl2.MethedSetB(sub) =3613.4749 MS
19:00:48 -- ClassA.FriendSetB(method sub) =146.3186 MS
19:00:48 -- ActiveXDll.Class2.A =126.242 MS
19:00:48 -- ActiveXExe3.Class1.A =316148.2625 MS
19:00:48 -- ActiveXExe5.Class1.A =11377.7648 MS
19:00:48 -- ActiveXExe.Class1.MethedSetB(SUB) =56888.8242 MS
19:00:48 -- ActiveXexe4.Class1.A(Remote Server)=310374.0469 MS
Code:QueryPerformanceCounter CPUv1 For i = 1 To TestTimes / ratio PubA = i Next QueryPerformanceCounter CPUv2 AddTestbyName "BasFile_Publicc_A" Dim ClassB As ActiveXDll.Class1 Set ClassB = New ActiveXDll.Class1 QueryPerformanceCounter CPUv1 For i = 1 To TestTimes / ratio ClassB.A = i Next QueryPerformanceCounter CPUv2 AddTestbyName "ActiveXDll.Class1.A"




Reply With Quote