[Scottish] Computing Power debate
George Richard Russell
scottish at mailman.lug.org.uk
Tue Oct 1 11:37:01 2002
On Tuesday 01 Oct 2002 11:03 am, you wrote:
> As for why C is popular: it does the job, its *largely* portable and, if
> you abstract out hardware differences, it can be made portable. What more
> do you _need_?
Polymorphism, first class functions, an unbroken type system, string support,
standard networking, threading etc
Perhaps I'm just spoilt.
> > 2. High level languages like python can, in theory, be much quicker
> > than low level languages: http://psyco.sourceforge.net/introduction.html
> But I'd say this is more because the language is interpreted rather than
> it being high or low level. If a language is compiled, then your stuffed:
> the compiler produces what it thinks of as the best code but it wont take
> into account any hot-spots.
Many interpreters compile to an intermediate form, which is then interpreted
- hence bytecode. This can then be JIT compiled at run time.
> > 3. Language choice is totally epsilon compared to algorithim choice,
> > the difference between C and Python is prolly in the order of 10% at
> > worst, the difference between a skip list and a linked list is so much
> > more.
Um, python is several orders of magnitude slower. Interpreters tend at best
to be twice as slow, often ten times a slow, and for pure interpreters, often
a 1000 times slower than compiled machine code.
http://www.bagley.org/~doug/shootout/bench/sieve/
C code for Sieve of Eratosthenes ~ under a quarter of a second
Python code - 47 seconds
Language choice is important for developer productivity. Choose a language
suitable for the task. (in most cases, anything other than C).
Once it works, it can be optimised. Until it works, its useless.
George