[
https://issues.apache.org/jira/browse/AVRO-2037?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Darryl Green updated AVRO-2037:
-------------------------------
Description: The use of boost::any to hold union types causes a significant
performance hit especially for small types - in particular the when using
[null,primitive] for optional primitive type elements of a schema. Most (all?)
implementations of std::any include a small value optimisation that avoids
allocation overhead for scalars and other small types. Its a little unfortunate
that the performance of a C++ binding of a notionally high performance
serialization format performs so poorly in this case (note - I had previously
proposed using boost::variant which would address this problem but would fail
to support recursive types or truly huge numbers of distinct types in a union).
Obviously this requires C++ 17 but could fall back to boost::any for older
compilers. (was: The use of boost::any to hold union types causes a
significant performance hit especially for small types - in particular the when
using [null,primitive] for optional primitive type elements of a schema. Most
(all?) implementations of std::any include a small value optimisation that
avoids allocation overhead for scalars and other small types. Its a little
unfortunate that the performance of a C++ binding of r a notionally high
performance serialization format performs so poorly in this case (note - I had
previously proposed using boost::variant which would address this problem but
would fail to support recursive types or truly huge numbers of distinct types
in a union). Obviously this requires C++ 17 but could fall back to boost::any
for older compilers.)
> Use std::any where available
> ----------------------------
>
> Key: AVRO-2037
> URL: https://issues.apache.org/jira/browse/AVRO-2037
> Project: Avro
> Issue Type: Improvement
> Components: c++
> Reporter: Darryl Green
>
> The use of boost::any to hold union types causes a significant performance
> hit especially for small types - in particular the when using
> [null,primitive] for optional primitive type elements of a schema. Most
> (all?) implementations of std::any include a small value optimisation that
> avoids allocation overhead for scalars and other small types. Its a little
> unfortunate that the performance of a C++ binding of a notionally high
> performance serialization format performs so poorly in this case (note - I
> had previously proposed using boost::variant which would address this problem
> but would fail to support recursive types or truly huge numbers of distinct
> types in a union). Obviously this requires C++ 17 but could fall back to
> boost::any for older compilers.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)