Skip to content

Commit 9215104

Browse files
oliverdialOliver Dial
andauthored
Don't recompile regex for every delay. 52.76->48.47 on 101x51 delay/… (#158)
On circuits that are about 50% delays, this is worth about 5% in CPU time. Not a huge win, but hey, it's one line :) Co-authored-by: Oliver Dial <[email protected]>
1 parent c058aba commit 9215104

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Dialect/QUIR/Utils/Utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ Duration::parseDuration(mlir::quir::ConstantOp &duration) {
350350

351351
llvm::Expected<Duration>
352352
Duration::parseDuration(const std::string &durationStr) {
353-
std::regex re("^([0-9]*[.]?[0-9]+)([a-zA-Z]*)");
353+
static std::regex re("^([0-9]*[.]?[0-9]+)([a-zA-Z]*)");
354354
std::smatch m;
355355
std::regex_match(durationStr, m, re);
356356
if (m.size() != 3)

0 commit comments

Comments
 (0)