本帖最后由 老刘 于 2018-6-27 17:30 编辑
本来想做长字串验证,800K的文本切割成100byte的,但masm连100个byte长的变量都不能搞,真是服
所以就做的短字串多次求长,一亿次,
结果如下(i3)
[Asm] 纯文本查看 复制代码 C:\masm32\_test>(
More? cscript -nologo %windir%\ElapsedTime.VBS C:\masm32\_test\test2.exe
More? cscript -nologo %windir%\ElapsedTime.VBS C:\masm32\_test\test2.exe
More? cscript -nologo %windir%\ElapsedTime.VBS C:\masm32\_test\test2.exe
More? )
4.8515625
4.8671875
4.80859375
C:\masm32\_test>(
More? cscript -nologo %windir%\ElapsedTime.VBS C:\masm32\_test\test.exe
More? cscript -nologo %windir%\ElapsedTime.VBS C:\masm32\_test\test.exe
More? cscript -nologo %windir%\ElapsedTime.VBS C:\masm32\_test\test.exe
More? )
2.1171875
2.13671875
2.42578125
C:\masm32\_test>
test.asm
[Asm] 纯文本查看 复制代码 Include masm32rt.inc
.code
start:
mov ecx,100000000
@@:
push ecx
mov eax,cfm$("Hello,World.")
Invoke StrLen,EAX
pop ecx
dec ecx
cmp ecx,0
jne @B
Invoke ExitProcess,NULL
end start
test2.asm
[Asm] 纯文本查看 复制代码 Include masm32rt.inc
.code
StrLen2 proc item:DWORD
push ecx
xor ecx,ecx
mov eax,item
@@:
mov cl,byte ptr [eax]
inc eax
jcxz @F
jmp @B
@@:
dec eax
sub eax,item
pop ecx
ret 4
StrLen2 endp
start:
mov ecx,100000000
@@:
mov eax,cfm$("Hello,World.")
Invoke StrLen2,EAX
dec ecx
cmp ecx,0
jne @B
Invoke ExitProcess,NULL
end start
哈哈,我想这已经可以说明一些问题了 |