Re: [Hampshire] [Tech] The 'speed of a language'

Top Page

Reply to this message
Author: Gordon Scott
Date:  
To: lug, Hampshire LUG Discussion List
Subject: Re: [Hampshire] [Tech] The 'speed of a language'
Hi,

On Wed, 29 Oct 2008, Vic wrote:
(quoting Rob Malpass)

> > So once a program is compiled - is any language faster than any other
> > nowadays? Two programs: one in C, one in Java doing the identical job -
> > is there anything anywhere that says one will always be faster for
> > non-trivial applications?


It can depend on how/when one perceives this. I've mentionel elsewhen
that I use Tcl/Tk. I also have a compler for it, which presumably makes
biinaries that execute quicker. But the binaries take longer to get up
and runing than the scripts do, so subjectively they're slower.

> As a general rule, the closer you are to the metal, the greater the
> *potential* for speed, but the higher the level of skill required to
> achieve that potential.


I've compared assembler generated by C compilers for 68k and PowerPC
targets and very often I could not write the code faster in assembler
than the C compiler does. Occasionally the C compiler would do something
extraordinary that I likely would not have thought of, so would be
quicker than my assembler.

Of course C is pretty close to the metal. I tend to think of it as a
high-level assembler.

A bad algorithm of course, can blow performance right out of the window!

G.
-- 
Gordon Scott                  http://www.gscott.co.uk


Haiku:        Tragic Irony
        Imagined Life Without Walls
        Windows Crash to Floor.


        Linux ... Because I like to *get* there today.