Parrots, Pythons And Things That Go Splat 43
ajs writes "As you may know, there was a contest between Dan Sugalski and Guido van Rossum over the performance of Parrot running Python byte-code, and the loser was to take a pie in the face. Well, in the end it was between Dan and time and Dan lost... he was unable to get the Python bytecode translator to work sufficiently well for the contest (it was fast, but not complete), but when Dan conceded, Guido was gracious enough to decline to throw a pie, what a sport! The Perl community, however, was not quite so gracious (they wanted to see Dan take a pie for the team), and the final event ended up being a benefit for the Perl Foundation. Meanwhile, see Dan's Blog for details on what sorts of Parrot goodness came of this."
IronPython (Score:5, Interesting)
No chance in hell (Score:5, Insightful)
Re:No chance in hell (Score:5, Interesting)
On my 450mhz PII, running a simple java application takes a few seconds to start, while the equiv. perl
or python program starts up without any noticable delay.
And perl has to compile the program before it runs it...
Parrot vs. JVM is going to be very interesting,
too. JVM is a stack-based VM, while I believe Parrot is register-based (like most real machines, actually.
Plus writting in parrot asm is fun!
Registers versus Stacks (Score:5, Interesting)
Parrot is indeed register based. At least when compared to Perl 5, this is a tremendous advantage. Perl 5's VM spends a lot of time fiddling with its stack (pushing a marker on, pushing arguments on, pulling arguments off and checking for a marker) that Parrot can avoid altogether. Of course, that means that Parrot needs to spend time saving and restoring register stacks, but Dan's position is that there's enough good research on the subject to make optimizations practical.
Tell me about it. I'm a day or two from checking in simple-but-useful OpenGL bindings.
Re:Registers versus Stacks (Score:4, Informative)
Parrot's register scheme really does help, as do PMCs, which allow much better polymorphism and much better extendability than Perl 5's built-in ADTs. Of course, the JIT and scary goto core don't hurt op execution and dispatch either.
I didn't mention that I prefer PIR so as not to confuse people, but you're right -- I much prefer writing for IMCC than for raw Parrot. Thankfully, having to care about the distinction mostly went away a long time ago.
Re:No chance in hell (Score:1)
Re:No chance in hell (Score:1, Informative)
Re:No chance in hell (Score:1)
Re:No chance in hell (Score:3, Informative)
Yes, but that's a one-shot cost. True, for quick and dirty cgi-bin execution it piles up. But for anything that takes longer than several seconds it's lost in the wash.
This is largely
Type inference (was Re:No chance in hell) (Score:3, Insightful)
These languages make certain assumptions about typing and binding that Python and Perl do not. Additionally, Java's class structure is much *much* more time-efficient (though I rather like it less) than Python's memory-efficient proto-based object structure. It's the nature of the languages. It's wh
Re:Type inference (was Re:No chance in hell) (Score:1, Insightful)
So... what type is x? An int? A string? A stream? You can't tell because it depends on what's passed to bar. If bar's around, you could use this to infer the type of x for foo. But for many such languages, bar is loaded at runtime *and* in some of them, the type of x passed into bar can change. Compiler researchers have been arguing for a variety of runtim
Re:Type inference (was Re:No chance in hell) (Score:1)
Another form of type "inference" done at run time is type feedback; that also gives reasonable performance, and IMO much has come of it, it just isn't be
Re:No chance in hell (Score:2)
And which Parrot allows you to if you wish. You're discussing languages, not VMs, but responding to a comment about VMs.
Additionally, Java's class structure is much *much* more time-efficient [...] than Python's memory-efficient proto-based object structure.
Well, again you're comparing language features not VM features, and in this particular case, you're going to be dissapointed, because even in pure Python
Re:No chance in hell (Score:2)
Re:IronPython (Score:2, Informative)
Re:IronPython (Score:2)
Re:IronPython (Score:5, Informative)
Let's not jump to conclusions, everyone. While he did lose the challenge, it seems that he lost itbecause there simply wasn't enough time to implement the functionality required to run the python scripts on the Parrot interpreter. Hopefully, the parrot interpreter would win this contest if it the developers had more time. See below for a quote from the concession:
This concludes the effort to implement the Pie-thon benchmark for
OSCON, because there isn't any chance to implement the needed bits for
b0.py in the remaining time.
Four of seven benchmarks are running: b1, b2, b3, and b6. b5 is done
partially. Three of these are faster on Parrot, but e.g. while b2.py
is running 3 times the speed of python, it takes just 0.2s here on a
Pentium 600, which makes it hard to say, what's faster for these test
collection.
The benchmarks are mainly testing the speed of builtin functions,
which are of course mature and optimized in Python, while a lot of the
builtins just didn't even exist in Parrot a month ago. When it comes
to just running arithmetic code, like in b2.py, Parrot is a lot
faster.
Excuses, excuses (Score:3, Informative)
Re:Excuses, excuses (Score:3, Informative)
This was never a "Python people" vs "Parrot people" bet. It was personal, between Guido and me, and I didn't factor in enough time to allow for delays, so I lost.
Re:Excuses, excuses (Score:2)
Re:IronPython (Score:2, Funny)
No, it was slower! (Score:4, Informative)
Its interesting to do a head-to-head comparison of the benchmarks Parrot completed (speedups are relative to CPython):
b1: IronPython 2.1x faster, Parrot 1.2x faster
b2: IP same speed, Parrot 3x faster
b3: IP 1.5x faster, Parrot 2.1x slower
b6: IP 1.2x faster, Parrot 1.5x faster
Score: 2 each. Both authors claim they can improve their benchmarks significantly yet, but you have to feel it will be easier for Dan as he's optimising the VM itself, Jim Hugunin can only optimize his IL output for an existing VM.
Parrot is already faster than IronPython... (Score:1)
Re:IronPython (Score:2, Informative)
OTOH, I do think it's going to be pretty hard to beat the combination of CPython and psyco. I've achieved speedups on code I've written of up to 24x, and it's claimed one can get up to a 100x speedup on certain limited types of code.
OTOOH,
Re:IronPython (Score:3, Interesting)
I think a lot of these performance comparisons will become moot in the face of a runtime optimizer because who's static optimizations are better than others' won't matter when you have an optimizer that operates at runtime and dynamically inspects what code is actually being executed and optimizes
Re:IronPython (Score:1, Interesting)
And life will be wonderful in heaven, where the lion lies down with the lamb[1] and baby Jesus is always smiling and the choir of saints sings sweet hymns to the Almighty and Java runs faster than C.
Back i
Re:Both slower than Java tho... (Score:5, Interesting)
Is that before or after you turn on psyco?
Benchmarks aren't everything (Score:2)
Re:Benchmarks aren't everything (Score:2)
That would almost certainly be limited by I/O speed, not the language.
Re:Benchmarks aren't everything (Score:3, Informative)
Who said anything about the running speed? Didn't I just discredit that? The point was that a programmer knowledgable in Perl, Python, and Java would most certainly implement the program very quickly in Perl or Python.
Re:Benchmarks aren't everything (Score:3, Insightful)
Re:Benchmarks aren't everything (Score:1)
Re:Benchmarks aren't everything (Score:2)
The contest was about the value of a JITed VM vs the CPython (or Perl 5, for that matter) style of syntax-tree / bytecode walking. It was Dan's claim that Parrot would be faster at running Python bytecode than CPython and he was basing that on early data from Perl 5 running on Parrot. Since Perl 5 had been shown to execute faster than Python (on top of CPython) for
Ex Parrot (Score:5, Funny)
Well, I'll soon fix that then.