Boost logo

Boost :

Subject: Re: [boost] Review request for variant2, review manager wanted
From: Peter Dimov (lists_at_[hidden])
Date: 2019-02-25 15:18:26


> https://github.com/pdimov/variant2/blob/develop/benchmark/benchmark1.md

John Elvind Helset reports (via Slack) that
using -DBOOST_VARIANT_VISITATION_UNROLLING_LIMIT=1 with Boost.Variant
results in significant runtime improvement on both g++ and Clang, to the
point where Boost.Variant consistently outperforms both variant2 and
std::variant on this specific benchmark.

Looking at the code, it seems to me that the switch statement is always
unrolled to the default of 20 even when the variant doesn't have as many
alternatives, which causes Clang to refuse to inline the visitation and
results in a performance loss.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk