Skip to content

Commit

Permalink
Prereserve some AST iteration state.
Browse files Browse the repository at this point in the history
Doesn't really seem measurable but doesn't hurt either.
  • Loading branch information
rsmmr committed Feb 23, 2024
1 parent a69ea34 commit 5efcbed
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hilti/toolchain/include/ast/visitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ class Iterator {
public:
using value_type = NodePtr;

Iterator() = default;
Iterator() { _path.reserve(20); }
Iterator(const NodePtr& root, bool include_empty, std::string_view limit_to_tag)
: _include_empty(include_empty), _limit_to_tag(limit_to_tag) {
_path.reserve(20);
if ( root )
_path.emplace_back(root, -1);
}
Expand Down

0 comments on commit 5efcbed

Please sign in to comment.