From: "Mauricio Fernández" Date: 2002-12-02T19:39:01+09:00 Subject: Re: Numerical Ruby On Mon, Dec 02, 2002 at 06:50:41PM +0900, Olivier Saut wrote: > On Sun, 01 Dec 2002, MikkelFJ wrote: > > > > > "Masahiro TANAKA" wrote in message > > news:20021201.192929.41625961.masa@ir.isas.ac.jp... > > > > > @Bz[1..-2,1..-2] += (dt/dy)*(@Ex[2..-1,1..-2] - @Ex[1..-2,1..-2]) > > > end > > > > > > For 500x500 array, the result of benchmark on my machine is: > > > > > > with loop: 8.69 sec > > > without loop: 0.31 sec > > > > > > This is actually pretty cool - now how much code would you need in C to get > > the same performance. > > Yes. After a rewrite following Masahiro's suggestion, my code is 50 > times faster! Can you estimate how its speed compares to something written in, say, Fortran? Could Ruby be made suitable for scientific apps if it were used as a glue to bring together extensions written in C? And could it possibly be made even faster if Ruby objects were smart enough to do some optimization based on their properties? Bringing together Ruby's convenience and expressive power with acceptable speed would be absolutely awesome. -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com martin@bdsi.com (no longer valid - where are you now, Martin?) -- from /usr/src/linux/drivers/cdrom/mcd.c