diff --git a/source/detail/serialization/xlsx_consumer.cpp b/source/detail/serialization/xlsx_consumer.cpp index 6ba6070f..3f34a9c3 100644 --- a/source/detail/serialization/xlsx_consumer.cpp +++ b/source/detail/serialization/xlsx_consumer.cpp @@ -58,9 +58,23 @@ struct hash namespace { -xml::qname qn(const std::string &namespace_, const std::string &name) +xml::qname &qn(const std::string &namespace_, const std::string &name) { - return xml::qname(xlnt::constants::ns(namespace_), name); + static auto &memo = *new std::unordered_map>(); + + if (!memo.count(namespace_)) + { + memo[namespace_] = std::unordered_map(); + } + + auto &ns_memo = memo[namespace_]; + + if (!ns_memo.count(name)) + { + ns_memo[name] = xml::qname(xlnt::constants::ns(namespace_), name); + } + + return ns_memo[name]; } #ifdef THROW_ON_INVALID_XML