ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-talk
ruby-talk
Re: OpenGL 3D gears demo for Ruby
by Ilmari Heikkinen other posts by this author
May 2 2005 1:35PM messages near this date
OpenGL 3D gears demo for Ruby | Re: Cloning into an object
su, 2005-05-01 kello 09:02, Arto Bendiken kirjoitti:
>  Hi there,

>  The results were a bit surprising, in a good way. On my Linux computer
>  with ATI Radeon 9700, the compiled version of the original gears.c
>  gives an average 1271 FPS, whereas the gears.rb version achieves an
>  average of 1203 FPS. (Both programs were run for a couple of minutes
>  and results averaged.) That's only a 6% gap in performance.

Hello,
The reason the Ruby version runs fast is because the gears-program uses
display lists and hence the draw function is pretty much limited just by
the speed of OpenGL's display list drawing efficiency. 

I did a couple of experiments comparing drawing the gears with and
without display lists and got the following results:

C, using display lists: 3321FPS
Ruby, using display lists: 3033FPS

C, without display lists: 2417FPS
Ruby, without display lists: 90FPS

The 27x speed difference sounds about right..

The gear function could probably be optimized by minimizing the amount
of Ruby math there and doing as much as possible with GL.Translate and
GL.Rotate, since the GPU does those (and fast!).

It's definitely possible to use Ruby for writing GL apps, though good
performance requires doing things in a way that uses GL's
performance-helping things as much as possible (HW T&L, vertex arrays,
display lists, or even writing inner loops and math-intensive parts in
C).


Anxiously waiting for the fast VM(s), :)
Ilmari 
Thread:
Arto Bendiken
Ilmari Heikkinen

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved