Skip to content

Commit 9e7291b

Browse files
committed
benchmark is_exe [skip ci]
1 parent 9eaf636 commit 9e7291b

File tree

4 files changed

+47
-23
lines changed

4 files changed

+47
-23
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- ".github/workflows/*/action.yml"
1111
- "!private/publish_gen_index_html.m"
1212
- "!scripts/**"
13-
- "!examples/**"
13+
- "!example/**"
1414

1515
# avoid wasted runs
1616
concurrency:

example/BenchmarkIsExe.m

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}) ...
2+
BenchmarkIsExe < matlab.perftest.TestCase
3+
4+
properties
5+
exist = fullfile(matlabroot, "bin/matlab")
6+
end
7+
8+
properties (TestParameter)
9+
fun = {@stdlib.is_exe, @stdlib.native.is_exe, @stdlib.legacy.is_exe, @javafun.is_exe, @python.is_exe}
10+
end
11+
12+
methods (Test)
13+
14+
function bench_exist(tc, fun)
15+
e = tc.exist;
16+
if ispc()
17+
e = e + ".exe";
18+
end
19+
20+
tc.startMeasuring()
21+
y = fun(e);
22+
tc.stopMeasuring()
23+
24+
tc.verifyEqual(y, true)
25+
end
26+
27+
28+
end
29+
30+
end

example/BenchmarkIsExeRun.m

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function [r, s] = BenchmarkIsExeRun()
2+
tname = "BenchmarkIsExe";
3+
4+
%% Exist, same
5+
r = run_bench(tname);
6+
s = sampleSummary(r);
7+
disp(sortrows(s, "Median"))
8+
9+
end
10+
11+
12+
function result = run_bench(name)
13+
suite = testsuite(name);
14+
exp = matlab.perftest.TimeExperiment.limitingSamplingError(MaxSamples=150, RelativeMarginOfError=0.1);
15+
result = exp.run(suite);
16+
end

example/bench_is_exe.m

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)