From: Rahul Sundaram <[email protected]>

>> Ultimately, yes, it does come down to the number of instructions which are
>> executed by a platform for performing a single function. No one in their
>> right mind will argue that a program written in C wouldn't be faster than
>> the equivalent program written in any other high level language - unless
>> the algorithm was implemented poorly.

>Never say never. There has been quite a few demonstrations otherwise
>available on the web. Feel free to look them up.

Again, it comes down to the algorithm used. If the algorithm used in C is
poor, then it is likely to be slower than the same functionality
implemented in a higher level language using a better algorithm.

Ultimately, a language has to be decomposed down to a bunch of
instructions in machine code.

The number and nature of these instructions in machine code and the number
of machine cycles that it would take to execute will determine the speed
of the operation. Ofcourse, you can optimize this further by executing
multiple instructions in parallel (if your architecture supports it).

Since C is just a very thin abstraction over assembly language, it will
tend to be quicker than pretty much anything else out there. Which also
explains why the Linux kernel is implemented in it. The only thing quicker
would be to get the compiler to output the code in assembly language and
then hand optimize the code before running it through an assembler.

Regards,
Prem





_______________________________________________
To unsubscribe, email [email protected] with 
"unsubscribe <password> <address>"
in the subject or body of the message.  
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

Reply via email to