Minor efficiency improvement by pre sizing match stack
This commit is contained in:
		@@ -470,8 +470,8 @@ namespace chaiscript
 | 
			
		||||
        oss << t_prepend << "(" << ast_node_type_to_string(this->identifier) << ") "
 | 
			
		||||
            << this->text << " : " << this->location.start.line << ", " << this->location.start.column << '\n';
 | 
			
		||||
 | 
			
		||||
        for (size_t j = 0; j < this->children.size(); ++j) {
 | 
			
		||||
          oss << this->children[j]->to_string(t_prepend + "  ");
 | 
			
		||||
        for (auto & elem : this->children) {
 | 
			
		||||
          oss << elem->to_string(t_prepend + "  ");
 | 
			
		||||
        }
 | 
			
		||||
        return oss.str();
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
@@ -67,6 +67,7 @@ namespace chaiscript
 | 
			
		||||
          m_multiline_comment_end("*/"),
 | 
			
		||||
          m_singleline_comment("//")
 | 
			
		||||
      {
 | 
			
		||||
        m_match_stack.reserve(2);
 | 
			
		||||
        setup_operators();
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user