Beta 2.0: Extremely slow running of unit tests when writing to Console?

If you are writing to console inside a test, this can really slow down the tests.

STR:

First run this and you'll see it's fairly quick to finish.

using System.Collections;


public void List()
{
IList list = new ArrayList(500);
for (int i=0; i < 500; i++)
{
list.Add("foo");
}

foreach(String item in list)
{
Assert.AreEqual("foo", item.ToString());
//Console.WriteLine(item.ToString());
}
}

Now uncomment the Console.WriteLine and you'll find it is significantly slower.

I'm on a 1.8 GHz Pentium M laptop, Dell D600 Latitude, VS.NET 2003.

1 comment
Comment actions Permalink

Yes, this is a know issue. The slowdown is caused by the suncronizing the
output window with the actual console output.

To sped-upthis case, youcould switchto the "failed" tab, or simply do not
track running test (uncheck the button in the Unit Test Runner toolbar)

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Victor Cosby" <no_reply@jetbrains.com> wrote in message
news:20787814.1147230848522.JavaMail.itn@is.intellij.net...

If you are writing to console inside a test, this can really slow down the
tests.

>

STR:

>

First run this and you'll see it's fairly quick to finish.

>

using System.Collections;

>


public void List()
{
IList list = new ArrayList(500);
for (int i=0; i < 500; i++)
{
list.Add("foo");
}

>

foreach(String item in list)
{
Assert.AreEqual("foo", item.ToString());
//Console.WriteLine(item.ToString());
}
}

>

Now uncomment the Console.WriteLine and you'll find it is significantly
slower.

>

I'm on a 1.8 GHz Pentium M laptop, Dell D600 Latitude, VS.NET 2003.



0

Please sign in to leave a comment.