Skip to content

Commit 3e72027

Browse files
authored
fix --modules= parsing in the benchmark entry point (#506)
The pattern captured `(\w+)`, which stops at the first comma, so `--modules=linalg,tensornetworks` silently loaded only `linalg`. On top of that, `only(...)` was applied to the capture rather than to the match, which threw for any module name longer than one character. [skip ci]
1 parent 04adde1 commit 3e72027

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎benchmark/benchmarks.jl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ const SUITE = TensorKitBenchmarks.SUITE
55
# Populate benchmarks
66
# Detect if user supplied extra arguments to load only specific modules
77
# e.g. julia benchmarks.jl --modules=linalg,tensornetworks
8-
modules_pattern = r"(?:--modules=)(\w+)"
8+
modules_pattern = r"(?:--modules=)([\w,]+)"
99
arg_id = findfirst(contains(modules_pattern), ARGS)
1010
if isnothing(arg_id)
1111
TensorKitBenchmarks.loadall!()
1212
else
13-
modules = split(only(match(modules_pattern, ARGS[arg_id]).captures[1]), ",")
13+
modules = split(match(modules_pattern, ARGS[arg_id]).captures[1], ",")
1414
for m in modules
1515
TensorKitBenchmarks.load!(m)
1616
end

0 commit comments

Comments
 (0)