Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion For performance, write it in C

Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!inka.de!rz.uni-karlsruhe.de!morpheus.pingos.org!news.erinye.com!talisker.lacave.net!lacave.net!not-for-mail
From: benj...@fysh.org
Newsgroups: comp.lang.ruby
Subject: Re: For performance, write it in C
Date: Wed, 26 Jul 2006 18:40:24 +0900
Organization: Service de news de lacave.net
Lines: 33
Message-ID: <25789.194.202.59.51.1153906822.squirrel@squirrelmail.fysh.org>
References: <44C72BE2.7010505@semantico.com>
NNTP-Posting-Host: bristol.highgroove.com
Content-Type: text/plain;charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: talisker.lacave.net 1153906857 36739 65.111.164.187 (26 Jul 2006 09:40:57 GMT)
X-Complaints-To: abuse@lacave.net
NNTP-Posting-Date: Wed, 26 Jul 2006 09:40:57 +0000 (UTC)
X-received-from: This message has been automatically forwarded from
   the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is
   SPAM, it did not originate at comp.lang.ruby. Please report the 
   original sender, and not us. Thanks!
   Please see http://hypermetrics.com/rubyhacker/clrFAQ.html#tag24 to.
In-Reply-To: <44C72BE2.7010505@semantico.com>
X-ML-Name: ruby-talk
X-Mail-Count: 203962
X-ruby-talk: <25789.194.202.59.51.1153906822.squir...@squirrelmail.fysh.org>
X-rubymirror: yes

Peter Hickman gave a very good article about prototyping in a scripting
language, and then re-coding in c:

*snip*

> If you really really want that performance boost then take the following
> advice very seriously - "Write it in C".

I totally agree that with the current state of the art, this is the
right approach.

Maybe it doesn't need saying, but I'm going to... in the vasy majority
of applications, almost all of their run time is a tiny wee small
fraction of the code. This is the part that I would write in c (or c++).
The vast majority of the code (and it's not there just for fun, it's
still completely important to the application) will use a vanishingly
small fraction of processor time. This is the bit that I would probably
leave in Ruby.

People talk about the 80:20 principle, but in my experience it's much
more like 99:1 for applications. 99% of the code uses 1% of the run
time. 1% of the code consumes 99% of the run time. That could be the
signal processing and graphics heavy applications that I have
experienced though.

Thanks for the comparison, it was great. And thanks for the very nice
pre-generation of look up tables in perl idea. Nice.

Cheers,
  Benjohn