.Net performance enhansement

K

Kovan Akrei

Hi,
What is the default heap size in CLR?
Does CLR take any options (as in JVM) to optimize the performance of a
mulithreaded application? For exmple increasing heap size.
How do I increase performance of the following application (test program)

public class DummyThread{
private Thread thread;
public DummyThread(){
thread = new Thread(new ThreadStart(Run));
}
private void Run(){}
}

class ThreadOverhead
{
static void Main(string[] args)
{
int maxThreads = 1000000;
for (int threads = 0; threads < maxThreads; threads++)
new DummyThread();
}
}

I hope my question are not that stupid :). I have searched news and msdn
pages, but I could not find answers to my questions.

Best regards from
Kovan Akrei
 
J

Jon Skeet [C# MVP]

Kovan Akrei said:
What is the default heap size in CLR?

I can't remember what it starts off as, but it will increase as needed.
Does CLR take any options (as in JVM) to optimize the performance of a
mulithreaded application? For exmple increasing heap size.

Not sure what multi-threading has to do with it, but the CLR increases
its heap size as required, like a JVM does. JVMs typically have maximum
heap sizes whereas (AFAIK) the CLR doesn't.
How do I increase performance of the following application (test program)

public class DummyThread{
private Thread thread;
public DummyThread(){
thread = new Thread(new ThreadStart(Run));
}
private void Run(){}
}

class ThreadOverhead
{
static void Main(string[] args)
{
int maxThreads = 1000000;
for (int threads = 0; threads < maxThreads; threads++)
new DummyThread();
}
}

You don't do that - creating a million threads is never going to be a
good idea.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top