3

Hi i want to find out the longest time needed to call a method or to create an object.

I thought of something like calling GC.Collect() before creating the object or during the method or calling some destructors.

Has anyone some hints or ideas for finding out some (or the) worst case scenarios?

best regards

Gobliins
  • 3,848
  • 16
  • 67
  • 122

1 Answers1

1

See this thread. Put the answer code in a loop and record lowest & highest time that come in. But that may not be actually that intersting. Here is better performance meassaring:

Run the code in you actual application to get a feel of a real life scenario

or

Run a test on say 100000 calls to whatever method you want to test then you can take an average of the call times which should give you a better indication if your method is slow or not

Community
  • 1
  • 1
walt jimi
  • 126
  • 1
  • Well thx for the answer, but the essence of the problem is not to find out if the method:"is slow or not?". The problem is:"how slow can the method be?". In managed code you always have the Problem with GC, which in Mono is conservative, so maybe there is another way except for random testing or even some configuration that gives more reliable results of the random tests. – Gobliins Feb 09 '11 at 07:55