Announcement

Collapse
No announcement yet.

Rewriting Old Solaris C Code In Python Yielded A 17x Performance Improvement

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rewriting Old Solaris C Code In Python Yielded A 17x Performance Improvement

    Phoronix: Rewriting Old Solaris C Code In Python Yielded A 17x Performance Improvement

    While we normally hear of rewriting code from Python and other scripting languages into C/C++ when its a matter of performance, in the case of Oracle Solaris it was taking old C code and modernizing it in Python 3 to yield a ~17x performance improvement...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite

  • #2
    Pretty interesting. Shows how much optimizing binaries for CPU instructions can make up for an otherwise relatively inefficient design. Let's face it, Python isn't exactly the fastest language out there.

    Meanwhile, if you were to use the Clear Linux build of Python (or perhaps PyPy), imagine how much faster it'd be.

    Comment


    • #3
      Algorithms are far more important than programming languages - that's really all there is to it.

      Essentially, a properly implemented set structure (likely using a tree or hash) is going to be much faster than a linked list ...

      "My rewrite of listusers in Python 3 turned out to be roughly a 10th of the number of lines of code - since Python includes native set manipulation and the C code had implemented the set operations it via linked lists." (emphasis added).

      Comment


      • #4
        Originally posted by vladpetric View Post
        Algorithms are far more important than programming languages - that's really all there is to it.

        Essentially, a properly implemented set structure (likely using a tree or hash) is going to be much faster than a linked list ...

        "My rewrite of listusers in Python 3 turned out to be roughly a 10th of the number of lines of code - since Python includes native set manipulation and the C code had implemented the set operations it via linked lists." (emphasis added).
        Yep. Optimized code is faster then unoptimized code. News at 11.

        Comment


        • #5
          How much of a speed increase would there have been if he had written it in good/modern C instead of Python? Or C++ or Rust?

          Comment


          • #6
            Originally posted by gamerk2 View Post

            Yep. Optimized code is faster then unoptimized code. News at 11.
            Well, does ESR know that?

            Originally posted by kaprikawn View Post
            How much of a speed increase would there have been if he had written it in good/modern C instead of Python? Or C++ or Rust?
            170x. https://benchmarksgame-team.pages.de...thon3-gpp.html

            Comment


            • #7
              God, I miss so much the old Firefox UI. It was magnificent!

              Comment


              • #8
                Originally posted by birdie View Post
                God, I miss so much the old Firefox UI. It was magnificent!
                Try SeaMonkey browser

                Seamonkey Browser screenshot

                Comment


                • #9
                  Originally posted by kaprikawn View Post
                  How much of a speed increase would there have been if he had written it in good/modern C instead of Python? Or C++ or Rust?
                  Modern C ain't that modern. Because of the severe limitations of the language, you don't get a hash set or a tree set in the standard library (from the JFC category).

                  In any case, the speedup (with C++/Rust) is likely to be small if the implementation spends most of the time in the set operations themselves, as opposed to the bytecode interpretor. That's primarily the slow part in Python.

                  In any case: (i) this is speculation. You can totally reimplement the piece of software in C++/Rust and benchmark it; and(ii) it's oftentimes useless to speed things up when they're way faster than they need to be, even with expected increases in load.

                  Comment


                  • #10
                    I think the title should be "Python is proven to be 17x faster than C"

                    Comment

                    Working...
                    X