Minor efficiency improvement by pre sizing match stack

This commit is contained in:
Jason Turner 2015-05-19 10:55:38 -06:00
parent 9da9012701
commit dec88db26c
2 changed files with 3 additions and 2 deletions

View File

@ -470,8 +470,8 @@ namespace chaiscript
oss << t_prepend << "(" << ast_node_type_to_string(this->identifier) << ") " oss << t_prepend << "(" << ast_node_type_to_string(this->identifier) << ") "
<< this->text << " : " << this->location.start.line << ", " << this->location.start.column << '\n'; << this->text << " : " << this->location.start.line << ", " << this->location.start.column << '\n';
for (size_t j = 0; j < this->children.size(); ++j) { for (auto & elem : this->children) {
oss << this->children[j]->to_string(t_prepend + " "); oss << elem->to_string(t_prepend + " ");
} }
return oss.str(); return oss.str();
} }

View File

@ -67,6 +67,7 @@ namespace chaiscript
m_multiline_comment_end("*/"), m_multiline_comment_end("*/"),
m_singleline_comment("//") m_singleline_comment("//")
{ {
m_match_stack.reserve(2);
setup_operators(); setup_operators();
} }