Boost logo

Boost :

Subject: Re: [boost] [uuids] On boost::uuids::uuid operator == performance.
From: Hite, Christopher (Christopher.Hite_at_[hidden])
Date: 2012-04-16 11:56:37


Michael Kochetkov:

int main() {
        uint8_t d1[16], d2[16];
        return memcmp(d1,d2,16);
}
Here is the result.

$LL4_at_main:
        mov esi, DWORD PTR [edx]
        cmp esi, DWORD PTR [ecx]
        jne SHORT $LN5_at_main
        sub eax, 4
        add ecx, 4
        add edx, 4
        cmp eax, 4
        jae SHORT $LL4_at_main
        xor eax, eax

--------
That's not really a fair test since it's all in one compilation scope. I try to just make an obj which has function which takes the stuff as a parameters like:
void foo(boost::uuids::uuid&, boost::uuids::uuid&)

Then the compiler cann't know where it aligned the thing on the stack or do any other quick optimizations (beyond the alignment of the type).

The fastest thing on x86 to do this might be an MMX instruction. I remember gcc doing MOVDQA to memset() a 16 byte structure. Though I remember it because it falsely assumed 16 byte alignment and crashed.

Is your beef with the compiler?

Looking at the code the performance would probably be better if a larger integer type were used and alignment>1.

Chris


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk