|
Boost : |
Subject: Re: [boost] Heads up - string_ref landing
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-11-17 16:42:07
On 16/11/12 18:38, Nevin Liber wrote:
> On 16 November 2012 10:54, Yanchenko Maxim <maximyanchenko_at_[hidden]> wrote:
>
>> Those are high-performance constructs. We can only pray that a compiler
>> will be smart enough to convert our iterator-based code to
>> memcpy/memcmp/memset, and from my experience compilers are not nearly as
>> smart if it's slightly beyond trivial cases.
>>
>
> Now we are getting somewhere. Actual experience. Could you elaborate on
> the compilers and constructs that need to be hand optimized into equivalent
> code because the optimizers aren't doing it themselves? Or are there
> better constructs with size that aren't equivalent to their pointer
> counterparts?
Hand-optimized code is better than what you obtain through automated
code generation optimization algorithms, since those algorithms are only
as smart as the transformations the people who engineered them could
make the system detect and do, and are therefore one-size-fits-all. On
the other hand, hand-optimized code is optimized specially for the
particular thing in question.
memcpy on x86-64, for example, is typically 1.5x faster when
specifically hand-optimized (and that's assuming the compiler detected
that it could apply vectorization, which is most of the time not the case).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk