From b9875e2844f67c3c8858f395c221075ec68fd037 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Sun, 28 Jun 2015 13:20:20 -0600 Subject: [PATCH] Miscellaneous performance tweaks --- include/chaiscript/dispatchkit/dispatchkit.hpp | 6 ++++-- include/chaiscript/dispatchkit/proxy_functions.hpp | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/chaiscript/dispatchkit/dispatchkit.hpp b/include/chaiscript/dispatchkit/dispatchkit.hpp index 0bbe083..6f704b6 100644 --- a/include/chaiscript/dispatchkit/dispatchkit.hpp +++ b/include/chaiscript/dispatchkit/dispatchkit.hpp @@ -1346,13 +1346,15 @@ namespace chaiscript Stack_Holder() : call_depth(0) { + stacks.reserve(2); stacks.emplace_back(1); call_params.emplace_back(); + call_params.back().reserve(2); } - std::deque stacks; + std::vector stacks; - std::deque> call_params; + std::vector> call_params; int call_depth; }; diff --git a/include/chaiscript/dispatchkit/proxy_functions.hpp b/include/chaiscript/dispatchkit/proxy_functions.hpp index 1e761fe..c2d4045 100644 --- a/include/chaiscript/dispatchkit/proxy_functions.hpp +++ b/include/chaiscript/dispatchkit/proxy_functions.hpp @@ -184,10 +184,10 @@ namespace chaiscript if (m_arity == 0) { return true; - } else if (m_arity > 1 && m_types.size() > 1) { - return compare_first_type(vals[0], t_conversions) && compare_type_to_param(m_types[2], vals[1], t_conversions); + } else if (m_arity > 1) { + return compare_type_to_param(m_types[1], vals[0], t_conversions) && compare_type_to_param(m_types[2], vals[1], t_conversions); } else { - return compare_first_type(vals[0], t_conversions); + return compare_type_to_param(m_types[1], vals[0], t_conversions); } } else { return false;