Geschwindigkeitsvergleich



  • Was ist schneller, wenn first..last (==die zu kopierenden Elemente) zwischen 100 und 255 liegt?

    ; 95   :        while (first != last)
    
        cmp ecx, edx
        je  SHORT $L8947
        push    esi
    $L8946:
    
    ; 96   :            *dest++ = *first++;
    
        mov esi, DWORD PTR [ecx]
        mov DWORD PTR [eax], esi
        add ecx, 4
        add eax, 4
        cmp ecx, edx
        jne SHORT $L8946
        pop esi
    $L8947:
    
    ; 97   :        return dest;
    ; 98   :    }
    
        ret 0
    

    oder

    ; _first$ = eax
    ; _last$ = ecx
    ; _dest$ = edx
    
    ; 93   :    {
    
        push    esi
        mov esi, eax
    
    ; 94   :        return static_cast<String::char_type*>(memcpy(dest, first, last-first));
    
        sub ecx, esi
        push    edi
        sar ecx, 2
        mov edi, edx
        mov edx, ecx
        shr ecx, 2
        mov eax, edi
        rep movsd
        mov ecx, edx
        and ecx, 3
        rep movsb
        pop edi
        pop esi
    
    ; 95   :        /*while (first != last)
    ; 96   :            *dest++ = *first++;
    ; 97   :        return dest;*/
    ; 98   :    }
    
        ret 0
    

    ?



  • Also ich tippe mal auf Methode 2! Warum misst du es nicht einfach nach?


Anmelden zum Antworten