Boost logo

Boost :

Subject: Re: [boost] [outcome] How to drop the formal empty state
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2017-05-27 17:12:25

2017-05-27 1:36 GMT+02:00 Niall Douglas via Boost <boost_at_[hidden]>:

> >> As mentioned in another discussion thread, the empty state is also used
> >> internally as a micro-optimisation. So it would likely remain internally
> >> whatever the decision taken here, as a tool for making the CPU expend
> >> identical CPU cycles on both positive and negative branches on state.
> >>
> >> Again, if people don't like that behaviour of outcome/result to be
> >> equally costly on T or E branches chosen,
> >
> >
> > What does it mean tha "outcome is equally costly on T or E branches
> chosen"?
> Have a look at, specifically the disassembly.
> As you'll note, the first possible state (empty) tends to be chosen by
> the compiler as the most likely. That implies a 20 cycle branch
> misprediction cost for each of the valued or errored states. So they are
> equally costly, which is intentional.

Would you not rather manually "predict" for the valued state?

Boost list run by bdawes at, gregod at, cpdaniel at, john at