Skip to content

Commit

Permalink
Reduce allocations in Builder::startProfiler.
Browse files Browse the repository at this point in the history
  • Loading branch information
bbannier committed Nov 20, 2023
1 parent dd39e48 commit 79a969c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hilti/toolchain/include/ast/builder/builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class Builder {

bool empty() const { return _block.statements().empty() && _tmps.empty(); }

std::optional<Expression> startProfiler(const std::string& name);
std::optional<Expression> startProfiler(std::string_view name);
void stopProfiler(Expression profiler);

private:
Expand Down
2 changes: 1 addition & 1 deletion hilti/toolchain/src/ast/builder/builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void Builder::setLocation(const Location& l) {
_block._add(statement::SetLocation(builder::string_literal(l.render())));
}

std::optional<Expression> Builder::startProfiler(const std::string& name) {
std::optional<Expression> Builder::startProfiler(std::string_view name) {
if ( ! context()->options().enable_profiling )
return {};

Expand Down

0 comments on commit 79a969c

Please sign in to comment.