Skip to content

Commit

Permalink
make discohawk a/b comparer run big batches faster
Browse files Browse the repository at this point in the history
  • Loading branch information
zeromus committed Jul 11, 2015
1 parent 21c355b commit 763c47c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions BizHawk.Client.DiscoHawk/DiscoHawk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public struct CHANGEFILTERSTRUCT

class DiscoHawk
{
static List<string> FindExtensionsRecurse(string dir, string extUppercaseWithDot)
static List<string> FindCuesRecurse(string dir)
{
List<string> ret = new List<string>();
Queue<string> dpTodo = new Queue<string>();
Expand All @@ -197,12 +197,10 @@ static List<string> FindExtensionsRecurse(string dir, string extUppercaseWithDot
if (dpTodo.Count == 0)
break;
dpCurr = dpTodo.Dequeue();
Parallel.ForEach(new DirectoryInfo(dpCurr).GetFiles(), (fi) =>
foreach(var fi in new DirectoryInfo(dpCurr).GetFiles("*.cue"))
{
if (fi.Extension.ToUpperInvariant() == extUppercaseWithDot)
lock(ret)
ret.Add(fi.FullName);
});
ret.Add(fi.FullName);
}
Parallel.ForEach(new DirectoryInfo(dpCurr).GetDirectories(), (di) =>
{
lock(dpTodo)
Expand Down Expand Up @@ -264,7 +262,7 @@ public void Run(string[] args)
if (scanCues)
{
verbose = false;
var todo = FindExtensionsRecurse(dirArg, ".CUE");
var todo = FindCuesRecurse(dirArg);
var po = new ParallelOptions();
var cts = new CancellationTokenSource();
po.CancellationToken = cts.Token;
Expand Down

0 comments on commit 763c47c

Please sign in to comment.