Boost logo

Boost :

Subject: Re: [boost] [uuids] On boost::uuids::uuid operator == performance.
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-04-16 09:25:30


on Mon Apr 16 2012, "Peter Dimov" <pdimov-AT-pdimov.com> wrote:

> Mathias Gaunard wrote:
>> The code above calls the std::_Equal symbol, not memcmp.
>> The code given for std::_Equal also does not contain a jump to any
>> other function.
>
> memcmp is inlined into _Equal. Replacing std::equal with memcmp yields
> the same assembly code, this time inlined directly at the point where
> == is invoked.

Don't forget alignment. Those DWORD comparisons/copies may only work
well for aligned memory but when you call memcmp, you erase alignment
information and the compiler may assume it's only char-aligned.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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