Python vs. Ruby: threads - advice appreciated

Christian Tismer tismer at tismer.com
Sun May 28 11:08:50 EDT 2000


Jean-Paul Smets wrote:
> 
> Hi,
> 
> I am currently comparing Python and Ruby for a personal project which requires
> many many threads.
> 
> I came across the "philosophers" example in Ruby and was surprised by its
> compacity (see below).
> I am wondering if it would be easy to write such an example in Python with as
> few lines of code ?
> 
> Also, I tried to push Ruby to its limits (N=10000) and everything went OK (50 Mo
> RAM was occupied though but this is only 5Ko per thread which I find quite
> good). I wonder if it is possible to go that far with Python, either with native
> threads or with microthreads in stackless Python ?

Microthreads in Stackless Python take around 400 byte each, if
every thread is just one frame deep (i.e. not executing function
calls).
If you assume every thread being one or two func calls deeper,
let's take an average of 1000 bytes for this, which makes for
10 MB for your example.

And sure, it is possible. I've been much farther already in my tests.

> Finaly, I found that Ruby has a very nice and completely transparent interface
> to Python libraries and extensions. So, I am wondering now what would be the
> inconvenience for me of switching to Ruby for my project.
> 
> Any advice will be deeply appreciated.

Ruby instead of Python is at least a matter of taste,
and I will continue with Python.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaunstr. 26                  :    *Starship* http://starship.python.net
14163 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     where do you want to jump today?   http://www.stackless.com




More information about the Python-list mailing list