|
Boost : |
Subject: Re: [boost] [optional] generates unnessesary code for trivial types
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-01-30 13:51:42
on Wed Jan 25 2012, "Simonson, Lucanus J" <lucanus.j.simonson-AT-intel.com> wrote:
> I don't personally think that the style of programming that optional
> is intended for is suitable for high performance/performance critical
> situations in the first place.
Why not? It seems like a great candidate for common compiler
optimizations.
> Pass by reference and return a bool for a conditional return value.
> Pass the bool and the object separately for a conditional argument.
> Pass or return a pointer and check if it is null. Yes, my advice
> really is to not use optional if you want performance.
Why?
> Even if we did everything you can think of to make optional fast you
> are still better off designing your interfaces in such a way that you
> don't need it if your goal is performance.
Why do you say that?
-- 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