Slashdot is powered by your submissions, so send in your scoop


Forgot your password?
Microsoft Programming IT Technology

Super-Fast Python Implementation for .NET and Mono 54

Lansdowne writes "Jim Hugunin, the creator of Jython, has released an incredibly fast implementation of Python for Microsoft .NET and Mono called IronPython. Here's his PyCON 2004 presentation, including some benchmarks. He concludes: 'Python is an extremely dynamic language and this offers compelling evidence that other dynamic languages should be able to run well on this platform.'"
This discussion has been archived. No new comments can be posted.

Super-Fast Python Implementation for .NET and Mono

Comments Filter:
  • cool stuff (Score:5, Interesting)

    by hattmoward ( 695554 ) on Tuesday May 18, 2004 @10:08PM (#9191895)
    I'm glad to see more alternative languages for the .NET/Mono platform... If we're gonna get stuck with it, we may as well make the best of it! :) Seeing Python run nice and fast, being a dynamic language and on a VM, is great stuff too.
    • Re:cool stuff (Score:3, Interesting)

      by AJWM ( 19027 )
      Cool indeed. But is there a C# compiler targetting Parrot yet? ;-) They look like they're almost both pretty groovy [].

      (There's a language I'd like to see on more platforms.)

    • Who says we're stuck with dotnet? Most Free Software machines have no JVM installed, and most will have no more reason to have a CLI either. Just about anything you can do with either (i.e. anything except talk to other, proprietary, components), you can do better natively, in a language not specifically crippled to advance crabbed corporate interests.

      The real lesson of this "superfast Python" is not that dotnet is a fast platform; it's the more prosaic observation that regular Python still has a great

      • Lisp (was Re:stuck?) (Score:3, Informative)

        by Tool Man ( 9826 )
        Those Lispy features are a powerful addition, which make it easier for a programmer to get their job done. If you would rather trade those features for performance, consider Fortran instead. It would be more useful if, rather than focus on the leverage of a single-platform solution, the implementors can approach the performance of various Common Lisp implementations. It is true that dynamic languages don't have to be slow; neither do they have to rely on Microsoft's runtime.
        • Fortran??? Surely you must be joking. The typical mantra about Fortran being fast is such a broad statement that it's most of the times wrong. Sure, lapack/blas are written in Fortran - but that's hardly a statement of Fortran's speed superiority (optimized binary code couldn't care less what language it was compiled from - and the platform-dependent blas optimizations use asm anyway).

          The problem is rather that C (the natural contender) allows a non-experienced user to screw up really badly. Anyway, in one
          • Heh. My point was not really that Fortran is the best choice for most people, but that slagging Lisp features in Python makes no sense. Other languages are working hard at adding those features... usually poorly. Python gets closer than most.
      • Re:stuck? (Score:3, Interesting)

        by jsac ( 71558 )
        A Python front end for Gcc could be fun. And nearly impossible. I suspect that Python's way too dynamic to be handled by anything but a run-time interpreter.
      • good luck getting eval to work in gcc

        • good luck getting eval to work in gcc

          Most Free Software platforms have Gcc on them already. Gcc could be part of the runtime, in place of some anonymous JITter.

      • Re:stuck? (Score:3, Insightful)

        by LWATCDR ( 28044 )
        I would not bet that most free software machines do not have a JVM installed. VMs are a great chance for OpenSource to really shine. I used java for an internal program at my company. It is a mission critical app and has worked well for two years now. The best part is that it also runs on Linux. When all of the mission crtical apps are available on Linux then we can move a large section of our office to Linux workstations.
        What most people do not understand is that for the vast majority of business apps the
      • Much of python's slowness comes from its meta programming ability: variables and class members basically HAVE to be implemented by hashtables.

        If you're willing to give up the dynamic nature and instead settle for scheme-y features, it could run a whole lot faster.
      • I don't think a Python front end for gcc would be impossible, but it'd need its own set of libs, and it'd probably have a fair amount of code added in for when interpretation is necesssary. That having been said...

        Maybe gcj would be a better place to start. Or, for that matter, maybe you could try to get jython compiled with gcj; sounds like it's been done before.
    • the problem is that this stuff does not exist (until proven otherwise)
      • the problem is that this stuff does not exist (until proven otherwise)

        It does exist, it is just not Open Source (at least yet).

        • It's not even closed source. There is no source or object code anywhere. If I can't test it, it does not exist. Even closed source can be demonstrated to exist. This can't.
    • I'm still keeping my fingers crossed hoping we don't get stuck with it. It will be a sad era when Microsoft dictates specifications to the Open Source and Free Software communities...
  • by clintp ( 5169 ) on Tuesday May 18, 2004 @10:13PM (#9191917)
    Maybe he could have gotten in on the Great Parrot/Python Pie-a-Thon []. Perhaps an opportunity to plaster both Guido and Dan with a cream pie...
  • by Anonymous Coward on Tuesday May 18, 2004 @10:50PM (#9192153)
    But Python really hold a candle to PHP or Perl. A language without dollar signs is a day without sunshine.

    Sorry to break it to you.
  • Next Question (Score:3, Interesting)

    by complete loony ( 663508 ) <> on Tuesday May 18, 2004 @10:55PM (#9192173)
    Is there anything the MONO team can do to improve support for dynamic languages?
    Though this would probably break their binary compatibility with MS's implementation.
    • Re:Next Question (Score:5, Informative)

      by Chester K ( 145560 ) on Tuesday May 18, 2004 @11:57PM (#9192485) Homepage
      Is there anything the MONO team can do to improve support for dynamic languages?

      Mono, today, actually would support dynamic languages better than Microsoft's framework, since they implement the DynamicMethod class, which Microsoft fully documents in their Longhorn SDK documentation, but won't actually be released until .NET 2.0 comes out.

      The DynamicMethod class allows you to load a method into memory for JITting and execution, and preserves the ability for you to unload that code from memory, which you can't do with full-fledged Assemblies, even those generated via Reflection.Emit -- in .NET, once an Assembly is loaded into memory, it stays there until the AppDomain quits.
      • You can, however, create new AppDomains. Then destroy them.
        • Yeah, and method calls into an object in another AppDomain is a thousand times slower than a locla method call isn't it?
        • You can, however, create new AppDomains. Then destroy them.

          Which is incredibly slow and limited, since you can only pass data between AppDomains if the data is serializable, which means no passing filehandles, sockets, API handles, or the like -- and then you encounter the overhead of having to serialize/deserialize it, which is considerable.
  • not released (Score:5, Insightful)

    by the quick brown fox ( 681969 ) on Tuesday May 18, 2004 @10:59PM (#9192199)
    I usually take "released" to mean there is an implementation that is publicly available. Unless I am somehow just missing it, it doesn't seem to have been released yet...
  • I haven't worked with Python yet though I plan to take a look at it soon. I know it is a scripting language but is there a way to compile it into native executable form? If not, what is needed to make a Python app run on a system without the interpreter installed or with an older or newer version? Would I need to ship something JRE-ish that would that make a HelloWorld package megabytes in size?
    • Re:Compiled Python (Score:5, Informative)

      by FrenZon ( 65408 ) * on Tuesday May 18, 2004 @11:46PM (#9192433) Homepage
      I haven't worked with Python yet though I plan to take a look at it soon. I know it is a scripting language but is there a way to compile it into native executable form?
      "You don't need the ability to compile Python to C code if all you want is a stand-alone program that users can download and run without having to install the Python distribution first. There are a number of tools that determine the set of modules required by a program and bind these modules together with a Python binary to produce a single executable..." Read More []
    • Theres a couple tools for packing Python into a single binary. The Python runtime itself is fairly small, but most apps will need a signifigant supset of the standard libraries as well, so you'll be shipping some pretty large files. When using wxPython it walks all over Java, though.
  • by WTFmonkey ( 652603 ) on Wednesday May 19, 2004 @12:27AM (#9192615)
    Is is "IronPython," the way we'd usually pronounce it, or do we put a little Rocky Balboa in it and call it the "I- ron Py- thon ?"
  • I like Python very much. I may not like .Net, but I'll take my favored languages where I can find 'em :)

    I'd suspect, though, that a Parrot implementation, as Parrot continues to develop, will prove to be faster, since it was designed with more dynamic languages in mind.
  • Psyco (Score:4, Informative)

    by fredrikj ( 629833 ) on Wednesday May 19, 2004 @03:36AM (#9193287) Homepage
    * Fast - IronPython-0.2 is 1.4x faster than Python-2.3 on the standard pystone benchmark.

    I don't know about pystone in particular, but Psyco [] (a dynamic compiler module that essentially replaces the Python interpreter's inner loop at runtime) tends to make code run much faster than that and can speed up algorithmic code tenfold or more.

    When running with Psyco, quicksort written in Python is actually faster than Python's built-in C mergesort []!
  • What changed? (Score:5, Interesting)

    by ameoba ( 173803 ) on Wednesday May 19, 2004 @05:32AM (#9193593)
    I remember some previous attempt to do Python under .NET that was painfully slow & eventually written off as a failure and blamed on .NET's inability to handle the level of dynamism required to implement Python. What's changed since then?

    Are we looking at some sort of fundamental breakthrough in working with the CLR here or was the problem simply tackled by a more experienced/insightful developer?
    • Re:What changed? (Score:2, Informative)

      by Anonymous Coward

      Why is IronPython Fast?

      High system performance is the end result of hundreds of small decisions rather than a single large one. Much of IronPython's performance comes from careful consideration of performance in each design choice. I've found that profilers are generally useless for improving the performance of serious applications and that the only good route involves trying a variety of different implementation strategies and comparing their performance in both micro and macro benchmarks. That sai
  • Incredibly fast? (Score:3, Insightful)

    by Fweeky ( 41046 ) on Wednesday May 19, 2004 @06:48AM (#9193819) Homepage
    A 50% speed boost isn't *that* much; The Python JIT runtime that was on SlashDot just a few weeks ago cited significantly higher increases in performance. Fast, yes, but I'm not amazed or anything here :)
  • Platform (Score:3, Interesting)

    by Hard_Code ( 49548 ) on Wednesday May 19, 2004 @09:25AM (#9194606)
    CLR is starting to become a prominent candidate for "open source development platform". Things like IronPython just make this sweeter. One-off interpreters are just a waste of time these days. You can get immense value by creating a generic-enough VM (like Parrot or CLR or JVM) and running <your-favorite-language> on it. Then you get all the benefits of consolidating effort on making the platform better. Next up should be PHP and Ruby (if they haven't already).

Money can't buy love, but it improves your bargaining position. -- Christopher Marlowe