Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit e6c797d

Browse files
authored
Merge pull request #2174 from leandro-lucarella-sociomantic/bench-nocompile
benchmark: Add option to avoid (re) compiling merged-on-behalf-of: Rainer Schuetze <rainers@users.noreply.github.com>
2 parents e62ced3 + 789cbd8 commit e6c797d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

benchmark/runbench.d

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ extern(C) __gshared bool rt_cmdline_enabled = false;
1313
struct Config
1414
{
1515
string pattern = r".*\.d", dmd = "dmd", dflags = "-O -release -inline", args;
16-
bool help, verbose;
16+
bool help, verbose, compile = true;
1717
uint repeat = 10;
1818
}
1919

@@ -76,14 +76,17 @@ void runTests(Config cfg)
7676

7777
foreach(ref src; sources.parallel(1))
7878
{
79-
writeln("COMPILING ", src);
8079
version (Windows) enum exe = "exe"; else enum exe = "";
8180
auto bin = buildPath(bindir, src.relativePath(cwd).setExtension(exe));
8281
auto obj = buildPath(objdir, src.relativePath(cwd).setExtension(exe));
8382
auto cmd = std.string.format("%s %s -op -od%s -of%s %s", cfg.dmd, cfg.dflags, obj, bin, src);
8483
if (auto ex = src in extra_sources)
8584
cmd ~= " -I" ~ src[0..$-2] ~ ".extra" ~ *ex;
86-
runCmd(cmd, cfg.verbose);
85+
if (cfg.compile)
86+
{
87+
writeln("COMPILING ", src);
88+
runCmd(cmd, cfg.verbose);
89+
}
8790
src = bin;
8891
}
8992

@@ -180,6 +183,7 @@ Config parseArgs(string[] args)
180183
config.passThrough,
181184
"h|help", &cfg.help,
182185
"v|verbose", &cfg.verbose,
186+
"N|no-compile", (string option) { cfg.compile = false; },
183187
"dflags", &cfg.dflags,
184188
"r|repeat", &cfg.repeat);
185189

@@ -237,7 +241,8 @@ void main()
237241

238242
import std.process : env=environment;
239243
cfg.dmd = env.get("DMD", "dmd");
240-
writeln("compiler: "~cfg.dmd~' '~cfg.dflags);
244+
if (cfg.compile)
245+
writeln("compiler: "~cfg.dmd~' '~cfg.dflags);
241246

242247
runTests(cfg);
243248
}

0 commit comments

Comments
 (0)