Python a hungrier beast than Ruby?


#1

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


#2

On 3/10/06, baalbek removed_email_address@domain.invalid wrote:

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


#3

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.


#4

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


#5

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

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).


#6

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?


#7

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.


#8

Aaron Lee wrote:

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