473,395 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

IronPython vs CPython: faster in 1.6 times?

Hi all,
the url http://torquedev.blogspot.com/2008/0...es-in-air.html
(blog of a game developers)
says IronPython is faster than CPython in 1.6 times.
Is it really true?
If yes, what are IronPython drawbacks vs CPython?
And is it possible to use IronPython in Linux?

D.
Feb 5 '08 #1
22 3951
IronPython runs on top of .NET. I would be suspect of any claims that
it is faster than cPython, just as I would of claims that Stackless or
Jython are faster.
Feb 5 '08 #2
Jeff wrote:
IronPython runs on top of .NET. I would be suspect of any claims that
it is faster than cPython, just as I would of claims that Stackless or
Jython are faster.
Well don't be. There are benchmarks that clearly show IronPython as
faster for selected tests. Other tests show CPython running more quickly.

As always, a benchmark is only really valuable on a typical workload for
the intended application.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Feb 5 '08 #3
Mike C. Fletcher:
Not sure if Mono also provides a speedup.
There is a set of good benchmarks here, the answer is negative:
http://shootout.alioth.debian.org/sa...=all&lang=iron

Bye,
bearophile
Feb 5 '08 #4
be************@lycos.com schrieb:
Mike C. Fletcher:
>Not sure if Mono also provides a speedup.

There is a set of good benchmarks here, the answer is negative:
http://shootout.alioth.debian.org/sa...=all&lang=iron
This doesn't look like Mono to me:

IronPython 1.1 (1.1) on .NET 2.0.50727.42

Stefan
Feb 5 '08 #5
On Feb 5, 12:31 pm, dmitrey <dmitrey.kros...@scipy.orgwrote:
Hi all,
the urlhttp://torquedev.blogspot.com/2008/02/changes-in-air.html
(blog of a game developers)
says IronPython is faster than CPython in 1.6 times.
Is it really true?
This is a second time around that IronPython piqued my interest
sufficiently to create a toy program to benchmark it and I must say
the results are not encouraging:

$ python bench.py
Elapsed time: 1.10 s

$ ipy bench.py
Elapsed time:65.01 s

and here is the benchmark program:

import time
start = time.time()

def foo(a):
return a * a

data = {}
for i in xrange( 10**6 ):
data[i] = foo(i)

print 'Elapsed time:%5.2f s' % ( time.time() - start)
Feb 5 '08 #6
On Feb 5, 8:01*pm, Istvan Albert <istvan.alb...@gmail.comwrote:
On Feb 5, 12:31 pm, dmitrey <dmitrey.kros...@scipy.orgwrote:
Hi all,
the urlhttp://torquedev.blogspot.com/2008/02/changes-in-air.html
(blog of a game developers)
says IronPython is faster than CPython in 1.6 times.
Is it really true?

This is a second time around that IronPython piqued my interest
sufficiently to create a toy program to benchmark it and I must say
the results are not encouraging:

$ python bench.py
Elapsed time: 1.10 s

$ ipy bench.py
Elapsed time:65.01 s

and here is the benchmark program:

import time
start = time.time()

def foo(a):
* * return a * a

data = {}
for i in xrange( 10**6 ):
* * data[i] = foo(i)

print 'Elapsed time:%5.2f s' % ( time.time() - start)
Could it be because .NET doesn't have arbitrary length integer types
and your little benchmark will create lots of integers 2**32 ?
What is the result if you replace foo(a) with

def foo(a): return sqrt(a)

--
Arnaud

Feb 5 '08 #7
On Feb 5, 4:56 pm, Arnaud Delobelle <arno...@googlemail.comwrote:
Could it be because .NET doesn't have arbitrary length integer types
and your little benchmark will create lots of integers 2**32 ?
What is the result if you replace foo(a) with
def foo(a): return sqrt(a)
Good observation, in the case above the run times are about the same.

i.
Feb 5 '08 #8
On Feb 5, 3:56*pm, Arnaud Delobelle <arno...@googlemail.comwrote:
On Feb 5, 8:01*pm, Istvan Albert <istvan.alb...@gmail.comwrote:


On Feb 5, 12:31 pm, dmitrey <dmitrey.kros...@scipy.orgwrote:
Hi all,
the urlhttp://torquedev.blogspot.com/2008/02/changes-in-air.html
(blog of a game developers)
says IronPython is faster than CPython in 1.6 times.
Is it really true?
This is a second time around that IronPython piqued my interest
sufficiently to create a toy program to benchmark it and I must say
the results are not encouraging:
$ python bench.py
Elapsed time: 1.10 s
$ ipy bench.py
Elapsed time:65.01 s
and here is the benchmark program:
import time
start = time.time()
def foo(a):
* * return a * a
data = {}
for i in xrange( 10**6 ):
* * data[i] = foo(i)
print 'Elapsed time:%5.2f s' % ( time.time() - start)

Could it be because .NET doesn't have arbitrary length integer types
A good reason to not use it.
and your little benchmark will *create lots of integers 2**32 ?
What is the result if you replace foo(a) with

def foo(a): return sqrt(a)

--
Arnaud- Hide quoted text -

- Show quoted text -
Feb 5 '08 #9
On 5 feb, 14:31, dmitrey <dmitrey.kros...@scipy.orgwrote:
Hi all,
the urlhttp://torquedev.blogspot.com/2008/02/changes-in-air.html
(blog of a game developers)
says IronPython is faster than CPython in 1.6 times.
Is it really true?
If yes, what are IronPython drawbacks vs CPython?
And is it possible to use IronPython in Linux?

D.
I posted a little benchmark some time ago in ironpython's list that
showed a big performance gap between both implementations (being
cpython much faster than ironpython).
Jim Hugunin replied showing that making the script more abstract
(encapsulating code as much as possible into functions) the .NET
framework makes a better job at optimizing everything.

So I took Istvan script and made a little modification as follows:

import time

def foo(a):
return a * a

def do():
start = time.time()
data = {}
for i in xrange( 10**6 ):
data[i] = foo(i)
print 'Elapsed time:%5.2f s' % ( time.time() - start)

do() # pre-run to avoid initialization time
do()

import psyco
psyco.full()

print '\nNow with psyco...\n'

do()
do()

input()

The result is that it runs slighty faster in both, IP and CP, but
cpython is still faster (around 2x) than ironpython.
However, when using psyco simply blows everything out of the water...

These are my results.

Ironpython 2.0 Alpha 8:
Elapsed time: 3.14 s
Elapsed time: 3.36 s

cpyhon 2.5:
Elapsed time: 1.55 s
Elapsed time: 1.58 s

Now with psyco...

Elapsed time: 0.88 s
Elapsed time: 0.80 s
Feb 5 '08 #10
Luis M. González wrote:
The result is that it runs slighty faster in both, IP and CP, but
cpython is still faster (around 2x) than ironpython.
However, when using psyco simply blows everything out of the water...
CPython is very fast here because it keeps blocks of allocated integer
objects to reduce the memory overhead. Your test shows that Python
highly specialized and optimized memory management for ints is superior
over IronPython's more general memory management. It also shows that
psyco optimized the function call. It's probably inlined.

You could replace foo(i) by i*i and see how much function calls affect
the speed.

Christian

Feb 6 '08 #11
Christian Heimes wrote:
Luis M. González wrote:
>The result is that it runs slighty faster in both, IP and CP, but
cpython is still faster (around 2x) than ironpython.
However, when using psyco simply blows everything out of the water...

CPython is very fast here because it keeps blocks of allocated integer
objects to reduce the memory overhead. Your test shows that Python
highly specialized and optimized memory management for ints is superior
over IronPython's more general memory management. It also shows that
psyco optimized the function call. It's probably inlined.

You could replace foo(i) by i*i and see how much function calls affect
the speed.
At the risk of boring you all, allow me to repeat:

"""
As always, a benchmark is only really valuable on a typical workload for
the intended application.
"""

There is no "better" and "worse" in the general case. Make rational
decisions. Benchmark your applications, don't scheme to make an
arbitrary benchmark run faster.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Feb 6 '08 #12
Stefan Behnel:
This doesn't look like Mono to me:
IronPython 1.1 (1.1) on .NET 2.0.50727.42
You are right! I think this shows that IronPython isn't faster than
CPython at all :-) (And it uses more memory).

Bye,
bearophile
Feb 6 '08 #13
On Feb 5, 11:47 am, Stefan Behnel <stefan...@behnel.dewrote:
bearophileH...@lycos.com schrieb:
Mike C. Fletcher:
Not sure if Mono also provides a speedup.
There is a set of good benchmarks here, the answer is negative:
http://shootout.alioth.debian.org/sa...?test=all&lang...

This doesn't look like Mono to me:

IronPython 1.1 (1.1) on .NET 2.0.50727.42

Stefan
Have you actually looked at the version string from IronPython-1.1-
Bin.zip running on Mono?
Feb 6 '08 #14
On Feb 6, 12:04 am, bearophileH...@lycos.com wrote:
Stefan Behnel:
This doesn't look like Mono to me:
IronPython 1.1 (1.1) on .NET 2.0.50727.42

You are right!
No.
I think this shows that IronPython isn't faster than
CPython at all :-) (And it uses more memory).

Feb 6 '08 #15
On Feb 5, 7:47 pm, Stefan Behnel <stefan...@behnel.dewrote:
bearophileH...@lycos.com schrieb:
Mike C. Fletcher:
Not sure if Mono also provides a speedup.
There is a set of good benchmarks here, the answer is negative:
http://shootout.alioth.debian.org/sa...?test=all&lang...

This doesn't look like Mono to me:

IronPython1.1 (1.1) on .NET 2.0.50727.42

Running on Debian? Fairly unlikely. :-)

Fuzzyman
http://www.manning.com/foord
>
Stefan
Feb 6 '08 #16
On Wed, 2008-02-06 at 13:39 -0800, Fuzzyman wrote:
On Feb 5, 7:47 pm, Stefan Behnel <stefan...@behnel.dewrote:
bearophileH...@lycos.com schrieb:
Mike C. Fletcher:
>Not sure if Mono also provides a speedup.
There is a set of good benchmarks here, the answer is negative:
>http://shootout.alioth.debian.org/sa...hp?test=all〈...
This doesn't look like Mono to me:

IronPython1.1 (1.1) on .NET 2.0.50727.42


Running on Debian? Fairly unlikely. :-)
Well, that *is* what the version string reports for IronPython on Mono
on Linux:

$ uname -sr
Linux 2.6.18-1.2200.fc5smp
$ mono ipy.exe
IronPython 1.1 (1.1) on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.

--
Carsten Haese
http://informixdb.sourceforge.net
Feb 6 '08 #17
Isaac Gouy wrote:
On Feb 5, 11:47 am, Stefan Behnel <stefan...@behnel.dewrote:
>bearophileH...@lycos.com schrieb:
>>Mike C. Fletcher:
Not sure if Mono also provides a speedup.
There is a set of good benchmarks here, the answer is negative:
http://shootout.alioth.debian.org/sa...?test=all&lang...
This doesn't look like Mono to me:

IronPython 1.1 (1.1) on .NET 2.0.50727.42

Stefan

Have you actually looked at the version string from IronPython-1.1-
Bin.zip running on Mono?
Why? Would that look like Mono? :)

Stefan
Feb 6 '08 #18
Fuzzyman wrote:
On Feb 5, 7:47 pm, Stefan Behnel <stefan...@behnel.dewrote:
>bearophileH...@lycos.com schrieb:
>>Mike C. Fletcher:
Not sure if Mono also provides a speedup.
There is a set of good benchmarks here, the answer is negative:
http://shootout.alioth.debian.org/sa...?test=all&lang...
This doesn't look like Mono to me:

IronPython1.1 (1.1) on .NET 2.0.50727.42


Running on Debian? Fairly unlikely. :-)
Why? Wasn't .NET supposed to be platform independent code and all that? ;)

Stefan
Feb 6 '08 #19
On Feb 6, 1:54 pm, Stefan Behnel <stefan...@behnel.dewrote:
Isaac Gouy wrote:
On Feb 5, 11:47 am, Stefan Behnel <stefan...@behnel.dewrote:
bearophileH...@lycos.com schrieb:
>Mike C. Fletcher:
Not sure if Mono also provides a speedup.
There is a set of good benchmarks here, the answer is negative:
http://shootout.alioth.debian.org/sa...hp?test=all〈...
This doesn't look like Mono to me:
IronPython 1.1 (1.1) on .NET 2.0.50727.42
Stefan
Have you actually looked at the version string from IronPython-1.1-
Bin.zip running on Mono?

Why? Would that look like Mono? :)

Stefan
Why? Because then you'd be doing more than expressing your personal
ignorance.
Feb 7 '08 #20
On Feb 5, 5:31 pm, dmitrey <dmitrey.kros...@scipy.orgwrote:
Hi all,
the urlhttp://torquedev.blogspot.com/2008/02/changes-in-air.html
(blog of a game developers)
saysIronPythonis faster than CPython in 1.6 times.
Is it really true?
If yes, what areIronPythondrawbacks vs CPython?
And is it possible to useIronPythonin Linux?

D.
Another interesting little benchmark of CPython and IronPython. Can't
see the code, but it looks like an implementation of the 11 queens
problem and IronPython comes out a clear winner on this one. (Looks
like no benchmark for psyco.)

http://www.sokoide.com/index.php?itemid=1427

Michael
http://www.manning.com/foord
Feb 12 '08 #21
Fuzzyman:
Another interesting little benchmark of CPython and IronPython. Can't
see the code, but it looks like an implementation of the 11 queens
problem and IronPython comes out a clear winner on this one. (Looks
like no benchmark for psyco.)
If you want a more reliable set of benchmarks, take all the shootout
benchmarks, and try them on IronPython on dotnet, on CPython and on
Psyco.

Bye,
bearophile
Feb 12 '08 #22
On Feb 12, 7:49 pm, bearophileH...@lycos.com wrote:
Fuzzyman:
Another interesting little benchmark of CPython and IronPython. Can't
see the code, but it looks like an implementation of the 11 queens
problem and IronPython comes out a clear winner on this one. (Looks
like no benchmark for psyco.)

If you want a more reliable set of benchmarks, take all the shootout
benchmarks, and try them on IronPython on dotnet, on CPython and on
Psyco.
Go for it!
Bye,
bearophile
Feb 12 '08 #23

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: John Salerno | last post by:
Hi all. I'm currently learning C#, and I'm also interested in learning Python (all of this just for fun, mind you), so it seems like a decent idea to want to integrate the two. But I don't quite...
25
by: Nainto | last post by:
I came across this link today. http://tinyurl.com/9c7ta It seems Microsoft is getting involved with Python. What do you think of it? Is it any good? Anything to worry about? -- Zach
3
by: Carl Johan Rehn | last post by:
What is the difference between CPython, Python for .NET, and IronPython? For example, if I'm running IronPython, can I access modules such as Numeric and numarray? As I understand it,...
3
by: Sanghyeon Seo | last post by:
I took some time to write this HOWTO: http://sparcs.kaist.ac.kr/~tinuviel/fepy/howto/simplehttpserver-ironpython-mono-howto.html IronPython seems to get much less interest than it deserves. This...
9
by: Luis M. González | last post by:
Check it out: http://www.gotdotnet.com/workspaces/workspace.aspx?id=ad7acff7-ab1e-4bcb-99c0-57ac5a3a9742
2
by: tkpmep | last post by:
I'm looking forward to the release IronPython, primarily for its IDE. I currently use scipy and pyExcelerator to crunch numbers and write them to Excel: does can these packages be used with...
9
by: Claudio Grondi | last post by:
(just wanted to share my experience with IronPython 1.0) The context: C:\IronPythonipy.exe IronPython 1.0.60816 on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved....
3
by: Jack | last post by:
I learned a lot from the other thread 'Is a "real" C-Python possible?' about Python performance and optimization. I'm almost convinced that Python's performance is pretty good for this dynamic...
1
by: jmDesktop | last post by:
I know that IronPython and CPython are different in that one does not use the .net framework, but are they both really the same Python language. From my basic understanding, it will depend on what...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.