"David Masover" <ninja / slaphack.com> wrote in message 
news:200909062319.35531.ninja / slaphack.com...
> On Sunday 06 September 2009 06:00:06 pm Michael Brooks wrote:
>> I'm not a Ruby guru or anything, I still do most of my coding in Delphi 
>> (I
>> love Ruby but it's too slow).
>
> I'm curious -- do you have any numbers to back this up? Or any real
> applications you tried in Ruby, and found it was too slow?
>
> Or is it that Delphi is somehow faster to develop in?
>
> I'm not saying you're wrong, but I do most of my coding in Ruby, because I
> rarely find places it's too slow. I'm always curious what those edge cases 
> are
> that need another tool.

Hello David:

Regarding code development speed:  For complex web applications (I use 
Delphi's built-in IntraWeb framework) and many Windows GUI applications I 
find Delphi much faster to work with.  The language and DB data providers 
are archaic by Ruby / Python standards but the integration between the IDE, 
language, built in components and the host windowing environment saves so 
much time for most of the projects I've worked on (e.g. database 
applications, graphics engines, data visualization, data generation / 
simulation, general utilities / home projects).  I've tried Ruby Rails 
before Delphi IntraWeb, it was easy to build simple stuff but as the visual 
and functional complexity went up it was just easier to use Delphi IntraWeb. 
I didn't know IntraWeb at the time but it's WYSIWYG design environment for 
the web pages which was tightly integrated with the Delphi code was so much 
faster to develop with... not like the "code generator / run it and see what 
it looks like" feel I got from Rails.

Regarding execution speed: I love the true OOP and metaprogramming of Ruby 
but it's so slow executing compared to a compiled language like Java, C++ or 
Delphi.  A while ago I wrote a simple test to calculate prime numbers with 
Delphi, Python and Ruby (using the same brute force approach in each) and 
found:

Delphi (v6.0) = 1.52s
Delphi (v2009) = 3.41s = 2.24 times slower than Delphi v6
Python (v2.8) = 54.25s = 35.69 times slower than Delphi v6
Ruby (v1.8.6) = 121.82s = 80.14 times slower than Delphi v6
Ruby (v1.9.1) = 53.70s = 35.33 times slower than Delphi v6

using a Pentium 4, 3.0 Ghz, 1GB Memory, Windows XP SP2.  I did the same test 
on SUSE Linux 10.2 and found Ruby to be about 30% faster than the results on 
Windows (note: Python was 20% slower on SUSE Linux so compilers and memory 
management appear to make a big difference).

That's not the only program I've written in both Delphi and Ruby.  I ported 
a Ruby XMLTV viewer (which deals with a little over a gigabyte of data) to 
Delphi and the Delphi program ran 2.5 times faster (i.e. 63 seconds vs 160 
seconds).  The Delphi program was at a disadvantage because the Delphi 
component I used applied an in-memory XML DOM approach vs the Ruby 
component's XML SAX approach (i.e. more memory overhead and validation for 
the Delphi program).

The OpenGL graphics engine I wrote in Ruby was very fast in the beginning 
(2100 FPS) for a simple 3D scenes because most of the work was being done on 
the GPU but as the engine grew to include reflection, shadows, AI (all of 
which require more passes per frame on the Ruby side) then it really slowed 
down (i.e. 60 FPS and dropping).  I'm still working on this project and hope 
to find better ways to use Ruby but found that Delphi didn't slow down as 
quickly in similar situations.

I also starting writing a source code translator (which is why I had some 
advice for this thread) which relied heavily on Ruby gsubs.  It's a lot 
faster than I expected (maybe %80 of the speed of an equivalent Delphi 
program) but that's likely because the gsubs are doing most of the work.

Ruby really gets killed by looping through stuff.  For my graphics engines 
that means multi-passes on 3d objects for the diffuse, reflection and shadow 
passes.  For XML parsing that means going through all the records in the XML 
file and parsing the tags/containers.  For the pirme number calculator that 
was simple looping.  Ruby does great if you can let the behind the scenes 
optimized functions (or external C/C++ libraries) do most of the work.

I"m not saying I used the best designs for either my Ruby or Delphi programs 
but for all the tricks and neat stuff I can do in Ruby there are limits to 
the time I'm willing to invest  in Ruby (i.e to write external routines or 
redesign things to use Ruby smarter) to get the speed I need.

I've seen the "Ruby / Python / Lua / etc is fast enough for me" discussion 
on various forums several times and it usually depends on the kind of thing 
you're trying to use the language for.  In my case I'm using Ruby for some 
of the worst case senarios that you can throw at an interpretive / VM 
language.

However, to Ruby's credit because of it's dynamic nature and true OOP I can 
do some things in Ruby for my game engine that I've always wished I could do 
in Delphi so I haven't given up hope on it yet.  The speed is the only real 
issue.

Did I answer you question?

Michael

p.s. Please forgive any poor grammer, etc... it's a long response and I 
don't want to re-read it to many times.