Minor efficiency improvement by pre sizing match stack
This commit is contained in:
parent
9da9012701
commit
dec88db26c
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user