From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2020-05-24 17:39:29
On Sun, May 24, 2020 at 1:14 AM Rainer Deyke via Boost <
> I notice that the LEAF documentation comes with benchmarks comparing
> leaf::result to other return-based error handling systems. That's good.
By the way, to use LEAF without exceptions, you don't have to use
leaf::result. For example, if you have a program that generally
communicates failures in terms of some other result<T>, usually you need
not change that in order to utilize LEAF to transport additional error
objects when needed.
As for the benchmark, it is not very fair to LEAF: it only tests the
performance when transporting a single error object. The killer feature of
LEAF is the ability to efficiently associate with a single failure any
number of error objects, of arbitrary types. To do this with another result
type, you'd have to allocate memory dynamically.
> I am currently using Boost.Exception, and I am satisfied with its
> functionality, but I am worried about its performance cost. LEAF claims
> to be a faster functional replacement for Boost.Exception, and is for
> this reason seems worth investigating. However, this claim does not
> appear to be backed up by any hard numbers.
Thank you for using Boost Exception. The claim that LEAF is faster is based
on the fact that Boost Exception allocates error objects dynamically and
keeps them organized in a std::map (stored in the exception object itself),
while LEAF keeps all error objects in a std::tuple stored in the stack
frame of the error-handling function that needs them (e.g. where the
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk