News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

stack vs memory

Started by loki_dre, April 21, 2008, 07:13:17 PM

Previous topic - Next topic

hutch--

Jim's inlining the memory copy was a good move, here is an addition that selects between short and long string copies that gets the speed up.


                        .if ecx > 1024

                          push esi
                          push edi
                          push ecx
                          mov esi,edx
                          mov edi,[edi]
                          shr ecx,2
                          rep movsd
                          pop ecx
                          and ecx,3
                          rep movsb
                          pop edi
                          pop esi

                        .else

                          push ebx
                          push esi
                          push edi

                          mov esi, edx
                          mov edi, [edi]
                          mov ebx, -1
                          @@:
                          add ebx, 1
                          ; movzx eax, BYTE PTR [esi+ebx]
                          mov al, [esi+ebx]
                          mov [edi+ebx], al
                          cmp ebx, ecx
                          jle @B

                          pop edi
                          pop esi
                          pop ebx

                        .endif
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

jj2007

Doesn't work out for me: H=Hutch, M=Memcopy

avg m=12640, avg h=12726 on a P4, 3.4 GHz, 1.5 G Ram, XP SP2

The MemCop equate in the attachment determines how it is being assembled.

D:\wwn\asm\DynArray>omsm

Loop 80 - len of first string is 04000
Ticks, UseHeap=1 : 12984
D:\wwn\asm\DynArray>omsh

Loop 80 - len of first string is 04000
Ticks, UseHeap=1 : 12797
D:\wwn\asm\DynArray>omsh

Loop 80 - len of first string is 04000
Ticks, UseHeap=1 : 12656
D:\wwn\asm\DynArray>omsm

Loop 80 - len of first string is 04000
Ticks, UseHeap=1 : 12297
D:\wwn\asm\DynArray>

[attachment deleted by admin]