[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Python a hungrier beast than Ruby?

RCS

3/11/2006 1:01:00 AM

I have tested two implementations of wxRuby/wxPython applications (stock
price data displayed as a simple graph, and as candlesticks).

The Python implementation only showed graphs from one company, while the
Ruby implementation showed graphs from ten compaines.

When I checked the memory usage, I was, quite frankly, stunned:

wxPython: 19 Mb memory usage
wxRuby: 11 Mb memory usage


What on earth is going on here?

The Ruby wx application is ten times larger than the Python wx
application, but only use 50% of the memory of Python.

Is it somehow a super optimized wxRuby as far as memory goes, or is Ruby
just more lean with memory resources than Python?

Baalbek
7 Answers

Curt Hibbs

3/11/2006 6:55:00 AM

0

On 3/10/06, baalbek <rcs@bgoark.no> wrote:
> I have tested two implementations of wxRuby/wxPython applications (stock
> price data displayed as a simple graph, and as candlesticks).
>
> The Python implementation only showed graphs from one company, while the
> Ruby implementation showed graphs from ten compaines.
>
> When I checked the memory usage, I was, quite frankly, stunned:
>
> wxPython: 19 Mb memory usage
> wxRuby: 11 Mb memory usage
>
>
> What on earth is going on here?
>
> The Ruby wx application is ten times larger than the Python wx
> application, but only use 50% of the memory of Python.
>
> Is it somehow a super optimized wxRuby as far as memory goes, or is Ruby
> just more lean with memory resources than Python?

All I can is is that neither Ruby nor wxRuby is super optimized. The
resources that they take are just what they naturally are without any
heroic efforts.

I can't speak to the Python side.

Curt


Mc Osten

3/11/2006 3:50:00 PM

0

Il 11-03-2006 baalbek ha scritto:

> What on earth is going on here?

Did you run the tests on Windows? On GNU/Linux (which distro?)
How did you install both ruby and python and the libraries?

Where debugging infos included ect etc?

Anyway here (MacOS X) the bare ruby interpreter takes less memory than
Python one. Anyway this does not prove anything. Still I have no idea
why this happens.

RCS

3/11/2006 4:45:00 PM

0

Mc Osten wrote:
> Did you run the tests on Windows? On GNU/Linux (which distro?)
> How did you install both ruby and python and the libraries?
>
> Where debugging infos included ect etc?
On Windows.

I simply ran the Python wx application with one of the wxPanels, and the
Ruby wx app with 10 of the wxPanels (including the wxPanel Python ran).

Then I checked the memory usage for each application (by the resource
manager in Windows).

The installs of both were standard installation exe's downloaded from
the net.

If debugging info were included, this I don't know; how would one check
if Ruby/Python runs with debugging info (using wx)?

Regards
baalbek

Mc Osten

3/11/2006 5:40:00 PM

0

baalbek ha scritto:

> If debugging info were included, this I don't know; how would one check
> if Ruby/Python runs with debugging info (using wx)?

You can check on the documentation of the packages. I suppose that it
could be possible that just some libs (for example the wx dll) is
compiled with debugging on.
However, I think this is not the case. Standard packages should not
include debugging... don't know, I haven't a win machine here right now.

Logan Capaldo

3/11/2006 5:54:00 PM

0


On Mar 10, 2006, at 8:18 PM, baalbek wrote:

> I have tested two implementations of wxRuby/wxPython applications
> (stock price data displayed as a simple graph, and as candlesticks).
>
> The Python implementation only showed graphs from one company,
> while the Ruby implementation showed graphs from ten compaines.
>
> When I checked the memory usage, I was, quite frankly, stunned:
>
> wxPython: 19 Mb memory usage
> wxRuby: 11 Mb memory usage
>
>
> What on earth is going on here?
>
> The Ruby wx application is ten times larger than the Python wx
> application, but only use 50% of the memory of Python.
>
> Is it somehow a super optimized wxRuby as far as memory goes, or is
> Ruby just more lean with memory resources than Python?
>
> Baalbek
>

Random theory, (which could be tested by looking at the source)
Python maybe grabs bigger chunks of memory from the OS at a time. If
ruby allocates 1024K at a time from the OS and python allocates 2048K
at a time from the OS the python memory would appear larger even if
the invidual python objects were slightly smaller or the same size as
the ruby objects (assuming tha each program creates a similar number
of objects).



Aaron Lee

3/12/2006 12:44:00 AM

0

baalbek wrote:
> I simply ran the Python wx application with one of the wxPanels, and the
> Ruby wx app with 10 of the wxPanels (including the wxPanel Python ran).
>
> Then I checked the memory usage for each application (by the resource
> manager in Windows).

Windows may be doing something funny with the shared libraries. Just for
kicks, what does it look like when you open the Ruby one first, then the
Python one?

--
Posted via http://www.ruby-....


RCS

3/13/2006 11:57:00 PM

0

Aaron Lee wrote:
> baalbek wrote:
>
>>I simply ran the Python wx application with one of the wxPanels, and the
>>Ruby wx app with 10 of the wxPanels (including the wxPanel Python ran).
>>
>>Then I checked the memory usage for each application (by the resource
>>manager in Windows).
>
>
> Windows may be doing something funny with the shared libraries. Just for
> kicks, what does it look like when you open the Ruby one first, then the
> Python one?
>

Same thing, whichever I open first.

HOWEVER, I might have found the cause:

the ruby application uses a database connection through drb, while the
Python application uses its own database connection.

My bad, that I did not think of this before posting on the ng...sorry!

Baalbek