From 7b3be825a054897f930239c19a8883f7e65dfb91 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Fri, 26 Aug 2016 19:06:36 +0200 Subject: [PATCH 1/2] Remove unneccsary array allocation --- rdmd.d | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rdmd.d b/rdmd.d index ab28e95f3a..765becc287 100644 --- a/rdmd.d +++ b/rdmd.d @@ -679,7 +679,7 @@ private string[string] getDependencies(string rootModule, string workDir, { // See if the deps file is still in good shape auto deps = readDepsFile(); - auto allDeps = chain(rootModule.only, deps.byKey).array; + auto allDeps = chain(rootModule.only, deps.byKey); bool mustRebuildDeps = allDeps.anyNewerThan(depsT); if (!mustRebuildDeps) { @@ -717,14 +717,14 @@ private string[string] getDependencies(string rootModule, string workDir, } // Is any file newer than the given file? -bool anyNewerThan(in string[] files, in string file) +bool anyNewerThan(T)(T files, in string file) { yap("stat ", file); return files.anyNewerThan(file.timeLastModified); } // Is any file newer than the given file? -bool anyNewerThan(in string[] files, SysTime t) +bool anyNewerThan(T)(T files, SysTime t) { // Experimental: running newerThan in separate threads, one per file if (false) From eaf92453fe56502dea3e1ed8429c47743daffac6 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Fri, 26 Aug 2016 19:12:52 +0200 Subject: [PATCH 2/2] Remove deprecated single-threaded compilation loop --- rdmd.d | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/rdmd.d b/rdmd.d index 765becc287..c795195961 100644 --- a/rdmd.d +++ b/rdmd.d @@ -726,31 +726,16 @@ bool anyNewerThan(T)(T files, in string file) // Is any file newer than the given file? bool anyNewerThan(T)(T files, SysTime t) { - // Experimental: running newerThan in separate threads, one per file - if (false) + bool result; + foreach (source; taskPool.parallel(files)) { - foreach (source; files) - { - if (source.newerThan(t)) - { - return true; - } - } - return false; - } - else - { - bool result; - foreach (source; taskPool.parallel(files)) + yap("stat ", source); + if (!result && source.newerThan(t)) { - yap("stat ", source); - if (!result && source.newerThan(t)) - { - result = true; - } + result = true; } - return result; } + return result; } /*