Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
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:
  • by The Fink ( 300855 ) <slashdot@diffidence.org> on Tuesday May 18, 2004 @10:55PM (#9192171) Homepage
    Using that as a benchmark, then some dialects of BASIC suit you too then, eh? :-)

  • 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 [python.org]
  • 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.
  • Lisp (was Re:stuck?) (Score:3, Informative)

    by Tool Man ( 9826 ) on Wednesday May 19, 2004 @12:49AM (#9192692)
    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.
  • Re:not released (Score:4, Informative)

    by Phronesis ( 175966 ) on Wednesday May 19, 2004 @01:39AM (#9192885)
    Indeed, anyone reading the links to IronPython would find that "IronPython is currently an unreleased research prototype."
  • 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 [sf.net] (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 [python.org]!
  • Re:Psyco (Score:3, Informative)

    by Anonymous Coward on Wednesday May 19, 2004 @06:11AM (#9193716)
    You got that comparison wrong; mergesort is algorithmically faster than quicksort.

    "Faster" is the wrong word. Mergesort has a lower order of complexity, which means it scales better in suboptimal situations.

    Remember, O(n^2) will always be "faster" than O(m) where n sqrt(m); the complexity of an algorithm is about scalability, not speed.
  • Re:What changed? (Score:2, Informative)

    by Anonymous Coward on Wednesday May 19, 2004 @11:18AM (#9195508)
    RTFA.

    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 said, there were a few rules that served me well.

    1. Use native CLR constructs whenever possible. These constructs are all heavily optimized by the underlying runtime engine. Sometimes these constructs will have to be used creatively to properly match Python's dynamic semantics.
    2. Use code generation to produce fast-paths for common cases. This can either be development-time code generation with Python scripts creating C# code or run-time code generation using System.Reflection.Emit to produce IL on the fly.
    3. Include fall-backs to dynamic implementations for less common cases or for cases where Python's semantics requires a fully dynamic implementation.
    4. Finally, test the performance of every CLR construct used and find alternatives when performance is unacceptable. Type.InvokeMember is a great example a a function that must never be used in code that cares about performance.

HELP!!!! I'm being held prisoner in /usr/games/lib!

Working...