You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The struct_to_tuple function builds, at runtime, what is effectively a copy of any struct, but organized as a tuple.
So if you have...
structmytype {
std::string value1;
std::string value2;
int x;
}
Then it will construct (at runtime), something like this...
std::tuple<std::string,std::string,int> t;
That's at runtime, so it is not at all free.
You can help things a little bit by casting to references so that you have...
std::tuple<std::string&,std::string&,int&> t;
In at least one benchmark, just replacing the copies by reference made a large difference (see #14).
Still, we construct an std::tuple for every single struct or class we serialize. While this construction is convenient, it might be unnecessary. A sufficiently advanced compiler can probably lift the overhead, but it might be better if we could get rid of this intermediate construction.
The text was updated successfully, but these errors were encountered:
The
struct_to_tuple
function builds, at runtime, what is effectively a copy of any struct, but organized as a tuple.So if you have...
Then it will construct (at runtime), something like this...
std::tuple<std::string,std::string,int> t;
That's at runtime, so it is not at all free.
You can help things a little bit by casting to references so that you have...
std::tuple<std::string&,std::string&,int&> t;
In at least one benchmark, just replacing the copies by reference made a large difference (see #14).
Still, we construct an
std::tuple
for every singlestruct
orclass
we serialize. While this construction is convenient, it might be unnecessary. A sufficiently advanced compiler can probably lift the overhead, but it might be better if we could get rid of this intermediate construction.The text was updated successfully, but these errors were encountered: