1

i've put this code in a class of my project in VS2013 .NET Framework 4.0

static List<string> f = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "imgdir\\").EnumerateFiles("*.*", SearchOption.AllDirectories).Select(x=>x.FullName).ToList();

is very very slow in debug mode (100'000 file > 3 minutes). if i run without debug is very fast (<5 seconds).

abrfra
  • 634
  • 2
  • 6
  • 24
  • You are asking the wrong question. It should be: "how can a program possibly find a hundred thousand files in less than 5 seconds?" It can't. Reboot your machine and try running it again. – Hans Passant Oct 10 '14 at 15:15

1 Answers1

0

The Debug mode does not optimize the binary it produces and generates additional data to aid debugging. The Release mode enables optimizations and generates less (or no) extra debug data.

Otherwise see this nice article from StackOverflow :-)

Performance differences between debug and release builds

Community
  • 1
  • 1
Xavius Pupuss
  • 160
  • 1
  • 6