Disclaimer: I am going out on a limb here so please be kind.
What you are asking is not easily quantifiable for the arbitrary case. But
lets take a concrete example of a Bresenham line drawing routine. Assuming
your Mr. Perfect coder is equally proficient and has expert skills in
Assembly, C++ and C#, the Assembly implementation would definately out
perform the C++ routine, which inturn out perform a corresponding C#
routine. This would be the case for any CPU intesive routine such as a JPEG
or MPEG encoder/decoder. The performance difference would be dependent on
the processor, however I believe even an expert Assembly programmer would
require multiple itterations to fully optimize the routine that therefore
requiring much more development time to complete the task, most likely the
initial Assembly version would only be slightly better than the C++ version.
The Assembly version will not only be faster it will most likely also
require less memory.
The example I have given here are for a routine that is possible executed
1000's, 100000's even 1000000's times per second so the difference of a few
clock cycles really makes a difference. However when accessing a database I
believe if the code is written by Mr. Perfect coder the DB access is going
to be the bottle neck so a few clock cycles on the processing would not make
much difference. I doubt it is possible to access a normal relational
database millions of times per second so the cycles in code do not make a
real diffence when networks and harddisks are in the equation. However if
you are reading data from a database and then doing a FFT on the data once
again the focus has shifted to the CPU intesive task and Assembly might be
the most performant implementation however a FFT in Assembly is a real
nightmare and I believe could be more than triple the development time of a
C++ implementation. However this would not warrent using Assembler to access
the data from the database, since ultimately you would be making a call to a
API function from dblib or OCI which whether you call it from C++, C# or
Assembly it is not going to execute any faster.
Use the right tool for the job.
CPU intensive tasks requiring highest possible throughput -> Assembly
Constrained Memory such as PICKs or AVRs -> Assembly
Low level kernel mode drivers ->
Assembly/C
Portable efficient source code with performance as priority -> C/C++
Secure robust
-> C#
Most other types of
-> C++/C#
With C# and C++ having the highest level of maintainability. OK, what ever I
have neglected to say I am sure others will fill in.
Hope this helps, if not try give a concrete example of what you want to do
and maybe someone can give you a more exact answer.
Chris Taylor