Jeroen Mostert
10/2/2008 11:02:00 AM
Leon_Amirreza wrote:
> 1- i can have a worse case on c#?! cant I? because the target is less
> capable of Intel core dou
> and because of scheduling overhead and because of .net overhead
> and Joreon you are right depends on these and that is why i need these
> insight info ( i have the exact target plaftform info and capabilitis but
> not .Net)
The "exact info" is an implementation detail. There are no books on it
because it's a moving target. The only way you can find out is to compile
programs and look at the assembler output. To get "exact info", you'd need
to have the source of the compiler and the runtime and a lot of free time
understanding them. I'm pretty sure both the compiler and the runtime are
closed-source, though a good part of the CLR and libraries are available in
source form.
There is info on how the garbage collector works, for example, but only in
broad strokes. It will not allow you to draw conclusions about individual
programs, you can only use it to explain performance problems when they crop
up. You will not get details like "allocating X objects will take Y
seconds, and if you did 'the same thing' in C it would take Z seconds" from
any book or site. The only way to find that out is to try it.
> and i have run my algorithm many times that gives an statistical average
> running time with some tolerance thats all; simple and effective i have
> done
> these kind of benchmarkings and wasnt so far from the reality (I am not
> interested in exact microsencod running time but the average) by
> microsecond
> I just meant i got this resolution in calculation time with windows Perf
> Counter not Environment.TickCounts thats all
>
Yes, you certainly can get a *worst* case. Unfortunately, your worst case
timings will say very little about how fast the code will run on your actual
platform once it's written in a different language and compiled by a
different compiler to a different architecture. It could be slower, it could
be faster. A very simple difference like cache size could already have a big
impact.
You can only establish that (for example) your code runs in linear time.
This is a property of the abstract *algorithm*, independent of the language
it's written in, and while it's certainly a useful thing to know, it says
little about how any particular implementation of that algorithm in *code*
will actually run.
> thank you for your time but STILL you havent answered mine questiuon!
>
I don't think your question is worth answering. If you want to know how fast
your code will run, write it, transfer it to the target platform, then
measure it. Unless your hardware does not yet exist, doing anything else is
a waste of time. You can do algorithmic analysis and that's useful, but
forget about timing.
--
J.