|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-10-08 09:41:19
At 02:36 PM 10/7/2002, Dave Harris wrote:
>In-Reply-To: <008c01c26e24$28c0d7c0$1d00a8c0_at_pdimov2>
>On Mon, 7 Oct 2002 20:08:29 +0300 Peter Dimov (pdimov_at_[hidden]) wrote:
>> Let's assume for the sake of discussion ;-) that you can do one million
>> shared_ptr allocations for 1.3 seconds. You turn on optimization X and
>> the time goes down to 1 second.
>>
>> Is this a significant speedup, in your opinion?
>
>Generally I don't get out of bed for less than a factor of 2. I'd
probably
>make an exception for a library routine which will be used intensively by
>a large number of other people. Unless the optimisation was ugly, I might
>go as low as 5-10%.
>
>Is the improvement consistent across a range of different compilers?
FWIW (which isn't much), I agree with Dave.
If an extremely minor tweak to the code produces a small improvement, well,
go for it. But it must meet a whole bunch of conditions: doesn't in any way
reduce readability or maintability, works uniformly for many or all
compilers, doesn't rely on problematic or undefined behavior, etc.
If those conditions aren't met, the optimization would have to produce at
least a factor of 2 improvement before I'd even think about it. If it was
really ugly, even a factor of 2 isn't worth it for most applications. There
may be exceptions for some specific applications, such as numerics code
used in inner loops.
For a lot of Boost code, however, a clean reference implementation is way
more important than minor speedups.
All IMO, of course.
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk