malloc performance affecting python performance 
Author Message
 malloc performance affecting python performance

If you're using python under SunOS4.1.4, you may be able to get a quick
performance boost by linking python with a different version of malloc/free.

The little benchmark functions included at the end of this message
were run on a machine with no other active processes.  The elapsed time
reported by time.time() should be close to the actual cpu time.   Yes,
the benchmark functions leave alot to be desired.

The benchmarks were run on a Sparc 20-like machine (ross hypersparc -
unknown MHz) running SunOS 4.1.4.

Python 1.4 beta 3 was compiled wth gcc (version 2.7.2) using compiler
optimization level set to -O3 .

The results show that the performance of at least some fine grained python
operations is significantly dependent on the performance of the malloc/free
package python is linked with.  

    libc   : python linked to use malloc/free from /usr/lib/libc.so.1.9
    libg++ : malloc from from gnu's libg++ statically linked into python
             (libg++-2.7.1 malloc.c)

              libc      libg++

    go()   -> 1.93   1.12
    go2()  -> 3.52   1.99


#######################################

import time

def go():
        ti = time.time()

        sum = 0
        for x in xrange(0,200000):
            sum = sum + x * .1

        print time.time() - ti
        print sum

def go2():
        ti = time.time()
        recur()
        recur()
        recur()
        recur()
        recur()
        print time.time() - ti

call_cnt = 0

def recur(how_far=5000):
        global call_cnt

        if (how_far > 0):
                call_cnt = call_cnt + 1
                recur(how_far - 1)
        else:
                print call_cnt

#######################################



Fri, 05 Mar 1999 03:00:00 GMT  
 malloc performance affecting python performance

Quote:

> If you're using python under SunOS4.1.4, you may be able to get a quick
> performance boost by linking python with a different version of malloc/free.
[snip]
> The results show that the performance of at least some fine grained python
> operations is significantly dependent on the performance of the malloc/free
> package python is linked with.  

>     libc   : python linked to use malloc/free from /usr/lib/libc.so.1.9
>     libg++ : malloc from from gnu's libg++ statically linked into python
>                 (libg++-2.7.1 malloc.c)

>          libc      libg++
>     go()   -> 1.93      1.12
>     go2()  -> 3.52      1.99

If you feel adventurous, you might try linking with Kiem Phong-Vo's
vmalloc package.  He presented it at USENIX last year, and there was
an article in Software Practice and Experience in late spring (May?),
and it's in 'Practical Reuseable UNIX Software'.  It's a highly bummed
drop-in malloc replacement, that lets you select the memory allocation
strategy used.  It should be at

http://www.research.att.com/orgs/ssr/book/reuse/license/packages/95/v...

(I can't verify as they seem to be off the net right now.)

Anyhow, I've been meaning to link Python with vmalloc and check
performance and memory consumption.  I've been meaning do the same
thing with Phong-Vo's Safe Fast I/O stdio replacement as well.

If I actually get around to testing this, I'll post results.  If
anyone else is sufficiently interested, please post results.

--
Tod A. Olson                        "How do you know I'm mad?" said Alice.

The University of Chicago Library    come here," said the Cat.



Tue, 16 Mar 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. NI KB tip may affect executable performance

2. Do comments affect performance?

3. ST80 performance; STA performance and booleans

4. C/Lisp/Python/Tcl - yet another performance comparision

5. performance problem in python 2.2

6. high-performance python web frameworks

7. Performance Issues with Threaded Python Network Server

8. how to get window performance data using python

9. Performance in embeded / extended python

10. Python Performance vs. C++ in a Complex System

11. Python 2.1 performance

12. python performance

 

 
Powered by phpBB® Forum Software