Optimize TupleObj
- remove one redundant layer of indirection in the storage of the
'value' -- items in a
std::unordered_map
are stable, so no need to store aunique_ptr<T>
, and instead just store aT
directly (asT
is highly constraint already in order to be able to write it into an NTuple). - perform lookup by
std::string_view
instead ofstd::string
as most usecases have a string literal (which is not anstd::string
) as argument, and previously, due to the use ofstd::string
this implied at least copying the characters, and (in case of an overflow of the SBO ofstd::string
) a memory allocation. - avoid creating an
std::vector<std::string>
inTupleObj::fill
while tokenizing the format specifier. - avoid using C-style VA_ARGS in
TupleObj::fill
which assumes (without any checking) that all arguments (other than the format string) aredouble
-- instead, use variadic template, and allow the arguments to be of different types.
Edited by Gerhard Raven