python memory use

Isaac Gouy igouy2 at yahoo.com
Wed Sep 30 13:19:41 EDT 2009


On Sep 30, 7:38 am, Gary Robinson <gary... at me.com> wrote:
> The chart athttp://shootout.alioth.debian.org/u32q/benchmark.php?test=all〈=ja...is very interesting to me because it shows CPython using much less memory than Java for most tests.
>
> I'd be interested in knowing whether anybody can share info about how representative those test results are. For instance, suppose we're talking about a huge dictionary that maps integers to lists of integers (something I use in my code). Would something like that really take up much more memory in Java (using the closest equivalent Java data structures) than in CPython? I find it hard to believe that that would be the case, but I'm quite curious.
>
> (I could test the particular case I mention, but I'm wondering if someone has some fundamental knowledge that would lead to a basic understanding.)
>

1) That URL is approximate averages rather than the straight Java
measurements.

2) Unless the programs are using *a lot* of memory you're just seeing
default JVM memory use.

3) More of the Java programs may have been re-written to use quad
core, which may use extra buffering.


So look for tasks that use a lot of memory and watch for time/space
tradeoffs -

2.1  Java 6 -server #2    29.32    259,868
62   Python #6            14 min   674,316
167  Python #2            38 min   221,236

http://shootout.alioth.debian.org/u32/benchmark.php?test=binarytrees&lang=all


2.8  Java 6 -server #2    46.87    363,488
34   Python               9 min    439,196

http://shootout.alioth.debian.org/u32/benchmark.php?test=knucleotide&lang=all


2.5  Java 6 -server #4    2.87     473,324
6.5  Python #3            7.67     543,908

http://shootout.alioth.debian.org/u32/benchmark.php?test=revcomp&lang=all



More information about the Python-list mailing list