[Vm-dev] Re: [squeak-dev] Squeak vs Python "smack down"

Levente Uzonyi leves at elte.hu
Tue Feb 8 11:32:01 UTC 2011


On Tue, 8 Feb 2011, Nicolas Cellier wrote:

>
> Just a detail, Python range(a,b) are semi open [a,b)
> think like C for(i=0;i<n; i++)
>
> In the Smalltalk proc8:withwith:with:with:: the range was interpreted as [a,b].
> This Smalltalk (and Cog) unfairly perform too much work.

And there's another one. In #proc0:block: the loops are (1 to: loops) do: 
instead of 1 to: loops do:.


Levente

>
> Nicolas
>
> 2011/2/8 stephane ducasse <stephane.ducasse at gmail.com>:
>>
>> This is really interesting to see that type inferencing can really help.
>> This is definitively a topic I would like to explore in the coming years.
>>
>> Stef
>>
>>
>>> Hi folks!
>>>
>>> Since we are on the verge of 4.2, and we have a brand new Cog VM to play with I felt like dusting off my old Pystone port to Squeak - Sqystone, which I wrote back in 2004.
>>>
>>> At that time Squeak was around 5 times faster than CPython. How do we stack up today? Yeah, I know - hardly a good benchmark, they all lie etc etc. :)
>>>
>>> I am using Ubuntu 10.10 on a corei7, so this is running on a 64 bit CPU.
>>>
>>>
>>> Cog!
>>> ====
>>> Squeak 4.2-10966 (soon to be released) + latest Cog r2361 (binary download):
>>> Pystone(1.1) time for 50000 passes = 0.06
>>> This machine benchmarks at 833333.3 pystones/second
>>>
>>> NOTE: AFAICT running with more passes does not improve it. Also, not sure if I could get more out of this if I built from source on my box.
>>>
>>>
>>> Regular Squeak
>>> ==============
>>> Squeak 4.2-10966 (soon to be released) + regular Squeak VM 4.4.7-2357 (built from src):
>>> Pystone(1.1) time for 50000 passes = 0.503
>>> This machine benchmarks at 99403.6 pystones/second
>>>
>>>
>>> Regular CPython
>>> ===============
>>> CPython 3.1.2 (newest in Ubuntu Meerkat, minimal):
>>> gokr at quigon:/usr/lib/python3.1/test$ python3.1 pystone.py
>>> Pystone(1.1) time for 50000 passes = 0.57
>>> This machine benchmarks at 87719.3 pystones/second
>>>
>>> NOTE: 3.2 is reportedly a teeny bit faster. Also not built from source.
>>>
>>>
>>> Pypy 1.4
>>> ========
>>> wget http://pypy.org/download/pypy-1.4.1-linux64.tar.bz2
>>> gokr at quigon:~/python/pypy-1.4.1-linux64$ ./bin/pypy ./lib-python/2.5.2/test/pystone.py
>>> Pystone(1.1) time for 50000 passes = 0.15
>>> This machine benchmarks at 333333 pystones/second
>>> gokr at quigon:~/python/pypy-1.4.1-linux64$ ./bin/pypy ./lib-python/2.5.2/test/pystone.py 5000000
>>> Pystone(1.1) time for 5000000 passes = 4.8
>>> This machine benchmarks at 1.04167e+06 pystones/second
>>>
>>> NOTE: Also not built from source. Here we run pystone a second time with 100x more loops and get a substantially better number.
>>>
>>>
>>> Shedskin 0.7
>>> ============
>>> sudo apt-get install g++ libpcre3-dev libgc-dev python-dev
>>> sudo dpkg -i shedskin_0.7_all.deb
>>> wget http://shedskin.googlecode.com/files/shedskin-examples-0.7.tgz
>>> shedskin pystone.py
>>> gokr at quigon:~/python/shedskin-examples-0.7$ make
>>> g++  -O2 -march=native -fomit-frame-pointer -Wno-deprecated  -I. -I/usr/share/shedskin/lib /usr/share/shedskin/lib/builtin.cpp pystone.cpp /usr/share/shedskin/lib/time.cpp /usr/share/shedskin/lib/re.cpp -lgc -lpcre  -o pystone
>>> gokr at quigon:~/python/gokr at quigon:~/python/shedskin-examples-0.7$ ls -la pystone*
>>> -rwxr-xr-x 1 gokr gokr 297329 2011-02-07 23:01 pystone
>>> -rw-r--r-- 1 gokr gokr   9193 2011-02-07 23:00 pystone.cpp
>>> -rw-r--r-- 1 gokr gokr   1893 2011-02-07 23:00 pystone.hpp
>>> -rw-r--r-- 1 gokr gokr   5774 2010-12-11 11:40 pystone.py
>>> gokr at quigon:~/python/shedskin-examples-0.7$ ./pystone
>>> This machine benchmarks at 2500000.000000 pystones/second
>>>
>>> NOTE: I am wondering a bit about this. It tells the same whatever loops I give it... But ok, perhaps it is all fine.
>>>
>>>
>>> Summary
>>> =======
>>>
>>> - The regular Squeak VM has not been overrun by CPython in these 6 years time. When I wrote Sqystone Squeak was 5x faster IIRC (can't find the post anymore). Now they are equal more or less, Squeak still a teeny bit faster.
>>>
>>> - Cog is brutally fast on this one. Compared to CPython and regular Squeak almost 10x faster.
>>>
>>> - Pypy is about 20% faster than Cog if given enough time to actually start jitting. Cool for the Pypy project! And cool that they aren't that much faster than Cog. :)
>>>
>>> - Shedskin is the "state of the art" of statically compiling Python via C++ using type inferencing etc etc - so I hear. It is said to be faster than Cython and Psyco. It ends up beating Cog, but "only" by a factor of 3x. I say "only" because that seems pretty good to me given that Cog is a JIT and still pretty young and that Shedskin can only run a subset of Python.
>>>
>>>
>>> regards, Göran
>>>
>>
>>
>>
>


More information about the Vm-dev mailing list