Python is far from a top performer according to benchmark test...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Krzysztof Stachlewski

    #16
    Re: Python is far from a top performer according to benchmark test...

    "JanC" <usenet_spam@ja nc.invalid> wrote in message
    news:Xns946BE66 E88E82JanC@213. 119.4.35...[color=blue]
    > "Krzysztof Stachlewski" <stach@fr.USUN. pl> schreef:
    >
    > I think all (or at least most) of the tested compilers, VMs, etc. were
    > written in C/C++, and thus are using libraries written in C/C++...[/color]

    Well, yes.
    Whether or not you can say that a piece of code
    is *really* implemented in a chosen language and not
    in "the language that this language is implemented in" ;-)
    is a matter of scale.

    I just think that the Numeric package
    is not the best example of the speed of Python itself.

    Stach

    Comment

    • Mike C. Fletcher

      #17
      Re: Straw poll on Python performance (was Re: Python is far froma top performer ...)

      Dave Brueck wrote:
      [color=blue]
      >Peter wrote:
      >
      >[/color]
      ....
      [color=blue][color=green]
      >>This is my "straw poll" question:
      >>
      >> Do you spend a "significan t" amount of time actually optimizing your
      >> Python applications? (Significant is here defined as "more than five
      >> percent of your time", which is for example two hours a week in a
      >> 40-hour work week.)
      >>
      >>[/color]
      >
      >Yay, straw poll! ;-)
      >
      >[/color]
      Indeed, yay ;) .

      I am often found optimising. The total time spent on it is probably
      somewhere around 1-2% of total (after all, I do still *use* Python, it's
      not like it's killing me). A lot of my projects are speed-sensitive
      (e.g. OpenGLContext trying to give interactive frame-rates in 3D
      scenegraph rendering, SimpleParse trying to create really fast parsers,
      web-sites trying to process 10s of thousands of records into summary
      views interactively), but I don't think I'm *that* far from the norm in
      the amount of time spent on optimisation.

      I'd be surprised if there's not some difference between the experience
      of library programmers and application programmers in this regard.
      Library developers tend to need to focus more effort on performance to
      allow users of the libraries some inefficiencies in their usage. That
      effort tends to be more in the planning stages, though, making sure
      you've chosen good algorithms, estimating work-loads and required
      throughput. You try to make sure the library is robust and fast by
      designing it that way, not by trying to optimise it after the fact. You
      plan for worst-case scenarios, and as a result you become "worried"
      about performance. An application developer is normally going to use
      optimised libraries and just run with it, only needing to deal with
      unacceptable performance if it happens to show up in their particular
      project.

      Anyway, back to it,
      Mike

      _______________ _______________ _________
      Mike C. Fletcher
      Designer, VR Plumber, Coder





      Comment

      • Rene Pijlman

        #18
        Re: Straw poll on Python performance (was Re: Python is far from a top performer ...)

        Mike C. Fletcher:[color=blue]
        >I am often found optimising.[/color]

        By an unoptimized or by an optimizing coworker? :-)

        --
        René Pijlman

        Comment

        • Mike C. Fletcher

          #19
          Re: Straw poll on Python performance (was Re: Python is far froma top performer ...)

          Rene Pijlman wrote:
          [color=blue]
          >Mike C. Fletcher:
          >
          >[color=green]
          >>I am often found optimising.
          >>
          >>[/color]
          >
          >By an unoptimized or by an optimizing coworker? :-)
          >
          >[/color]
          Well, in a perfect world, it would be by a lovely and svelte lady,
          missing her husband and seeking to drag me off to connubial bliss (we'll
          assume for propriety's sake that the husband would be me), but in my sad
          and lonely condition, it's normally I who finds myself late at night,
          feverishly optimising ;) :) .

          All a man really needs to be happy is work, and a woman to drag him away
          from it, or so I'm told,
          Mike(y)

          _______________ _______________ _________
          Mike C. Fletcher
          Designer, VR Plumber, Coder





          Comment

          • Jp Calderone

            #20
            Re: Straw poll on Python performance (was Re: Python is far from atop performer ...)

            On Fri, Jan 09, 2004 at 05:09:37PM -0500, Peter Hansen wrote:[color=blue]
            > Iwan van der Kleyn wrote:[color=green]
            > >
            > > In other words: it would be nice if Python on average would run faster
            > > so the need for optimisation would lessen.[/color]
            >
            > I disagree with the above. My opinion has long been that Python runs
            > adequately fast and that few people should need to spend much time on
            > optimization. Maybe that sort of view should be put to the test.
            >
            > This is my "straw poll" question:
            >
            > Do you spend a "significan t" amount of time actually optimizing your
            > Python applications? (Significant is here defined as "more than five
            > percent of your time", which is for example two hours a week in a
            > 40-hour work week.)
            >[/color]

            No.

            Jp

            Comment

            • Ken

              #21
              Re: Straw poll on Python performance (was Re: Python is far from a top performer ...)

              > Do you spend a "significan t" amount of time actually optimizing your[color=blue]
              > Python applications? (Significant is here defined as "more than five
              > percent of your time", which is for example two hours a week in a
              > 40-hour work week.)[/color]

              Some of them.

              I'm using python for data transformations : some feeds are small and
              easily handled by python, however the large ones (10 million rows per
              file) require a bit of thought to be spent on performance. However,
              this isn't exactly python optimization - more like shifting high-level
              pieces around in the architecture: merge two files or do a binary
              lookup (nested-loop-join) one one? etc...

              To make matters worse we just implemented a metadata-driven
              transformation engine entirely written in python. It'll work great on
              the small files, but the large ones...

              Luckily, the nature of this application lends itself towards
              distributed processing - so my plan is to:
              1. check out psycho for the metadata-driven tool
              2. partition the feeds across multiple servers
              3. rewrite performance-intensive functions in c

              But I think I'll get by with just options #1 and #2: we're using
              python and it's working well - exactly because it is so adaptable.
              The cost in performance is inconsequential in this case compared to
              the maintainability .

              Comment

              • Terry Reedy

                #22
                Re: Python is far from a top performer according to benchmark test...


                "Krzysztof Stachlewski" <stach@fr.USUN. pl> wrote in message
                news:btn5db$2f8 $1@absinth.dial og.net.pl...[color=blue]
                > "Carl" <phleum_nospam@ chello.se> wrote in message
                > news:ryELb.238$ tK2.228@amstwis t00...
                > With "heavy use of Numeric module" you were calling functions
                > written in C. So how can you say that Python is fast,
                > when C code is doing all the work.[/color]

                Well gee. *All* of the functions exposed in builtins *and* in built-in
                modules are also written in C. So are all the methods of builtin types and
                all the hidden functions (some exposed in the C API), including the
                compilation and interpretation. So how can anyone even talk about the
                speed of Python, when C code is doing all the work, whether quickly or
                slowly!

                [and in another post][color=blue]
                >I just think that the Numeric package is not the best example
                > of the speed of Python itself.[/color]

                But what is 'Python' itself? I think you are making a false distinction.
                Numerical Python and other scientific code driving C and Fortran functions
                was a, if not the killer app for Python when I learned it about 7 years
                ago. It was so important to the early success of Python, such as it was,
                that the slice object was added just for its use.

                Terry J. Reedy



                Comment

                • Brian Kelley

                  #23
                  Re: Straw poll on Python performance (was Re: Python is far froma top performer ...)

                  > This is my "straw poll" question:[color=blue]
                  >
                  > Do you spend a "significan t" amount of time actually optimizing your
                  > Python applications? (Significant is here defined as "more than five
                  > percent of your time", which is for example two hours a week in a
                  > 40-hour work week.)[/color]

                  Yes and No :) I find that optimizing algorithms is a lot more
                  beneficial than optimizing code. Let me give a small example. I have
                  written a chemoinformatic s engine (http://frowns.sourceforge.net/) and
                  one of it's features is substructure searching. That is finding if a
                  graph is embedded in another graph. This is an NP-Complete problem. A
                  company recently compared their technique in terms of speed and
                  correctness to frowns. According to them, frowns was 99% percent
                  correct but 1000x slower. (Why they were marketing their system which
                  was built over 5+ man years against mine which was built over 3 months I
                  never will understand)

                  Now, 1000x is a *lot* slower. However, when used in practice in a
                  database setting, my system has a quick mechanism that can reject false
                  matches very quickly. This is standard practice for chemistry databases
                  by the way. All of a sudden the 1000x difference becomes almost
                  meaningless. For a given search across 300000+ compounds, my system
                  takes 1.2 seconds and their's takes 25 minutes. Using my prefiltering
                  scheme their system takes 0.7 seconds. Now my code didn't change at
                  all, only the way it was used changed.

                  I could, of course, generate an example that takes me much longer but
                  the average case is a whole lot better. My system is free though, so my
                  users tend not to mind (or quite honestly, expect) as much :)

                  Brian


                  Comment

                  • Lothar Scholz

                    #24
                    Re: Python is far from a top performer according to benchmark test...

                    Samuel Walters <swalters_usene t@yahoo.com> wrote in message news:<pan.2004. 01.09.21.35.40. 132608@yahoo.co m>...
                    [color=blue]
                    > For numerical processing, C is the right tool,[/color]

                    Definitely not, you don't want a pointer language when using numerical
                    processing: use Fortran.

                    Comment

                    • Sean 'Shaleh' Perry

                      #25
                      Re: Straw poll on Python performance (was Re: Python is far from atop performer ...)

                      On Friday 09 January 2004 14:09, Peter Hansen wrote:[color=blue]
                      >
                      > Yes or no answers suffice, but feel free to follow up with a paragraph
                      > qualifying your answer (or quantifying it!). :-)
                      >[/color]

                      not any longer.

                      As I learned on this and the tutor list, writing code in Pythonic style tends
                      to also result in code being fast enough. Most of my early problems resulted
                      from trying to write C in Python.


                      Comment

                      • Tim Delaney

                        #26
                        Re: Straw poll on Python performance (was Re: Python is far from a top performer ...)

                        From: "Peter Hansen" <peter@engcorp. com>
                        [color=blue]
                        > This is my "straw poll" question:
                        >
                        > Do you spend a "significan t" amount of time actually optimizing your
                        > Python applications? (Significant is here defined as "more than five
                        > percent of your time", which is for example two hours a week in a
                        > 40-hour work week.)[/color]

                        I have to say that I do, but I'm also dealing with datasets up to about
                        500MB in the worst case - but about 10-20MB in the normal case.

                        In most cases, the optimisations are things like only doing a single pass
                        over any file, etc. A naive prototype often doesn't scale well when I need
                        to deal with large datasets. Often using psyco will be sufficient to get me
                        over the hurdle (see the psyco thread) but sometimes not.

                        Tim Delaney


                        Comment

                        • Skip Montanaro

                          #27
                          QOTW?


                          QOTW perhaps?

                          Sam> I read the benchmark and I think it doesn't measure python in it's
                          Sam> target area. That's like taking a world-class marathon runner and
                          Sam> wondering why he doesn't compete well in a figure-skating event.

                          Skip

                          Comment

                          • Samuel Walters

                            #28
                            Re: Python is far from a top performer according to benchmark test...

                            |Thus Spake Lothar Scholz On the now historical date of Fri, 09 Jan 2004
                            21:29:56 -0800|
                            [color=blue]
                            > Samuel Walters <swalters_usene t@yahoo.com> wrote in message
                            > news:<pan.2004. 01.09.21.35.40. 132608@yahoo.co m>...
                            >[color=green]
                            >> For numerical processing, C is the right tool,[/color]
                            >
                            > Definitely not, you don't want a pointer language when using numerical
                            > processing: use Fortran.[/color]

                            Hmm. I feel misunderstood. I'm going to try to clarify, but if I'm the
                            one doing the misunderstandin g, feel free to give me a good old-fashioned
                            usenet style bitchslapping back to the stone age.

                            First off: Truth in advertising.
                            I know very little about numeric processing, and even less about Fortran.
                            It's true that my background is in mathematics, but in *pure* mathematics
                            where pointer-based languages tend to be helpful, not hurtful. I chose
                            pure mathematics precisely because it eschews the grubby sort of shortcuts
                            that applied mathematics uses. In other words, I didn't have the proper
                            sort of mathematical intuition for it, so I chose pure, where my kind of
                            intuition works well. (In the end, this was to my detriment. All the
                            interesting problems are in applied math!)

                            As I see it, when one considers which language is best for one's needs,
                            one considers a couple of things:

                            1) Does the language have the semantics I want.
                            2) Does the language have the primitives I need.
                            3) Can I *easily* build any missing or suboptimal primitives.

                            One would assume that Fortran has the proper semantics for numerical
                            processing because it seems to have been wildly successful for a long
                            period of time. It would appear that Python has the proper semantics for
                            numerical processing because a significant number of people are using it
                            for that, and they'd be using something else if Python caused them too
                            many headaches.

                            Fortran naturally comes with the primitives for numerical processing,
                            because numerical processing is its stated goal. ("FORmula TRANslation")
                            Python doesn't seem to have the native and optimal primitives for
                            numerical processing, so that leads to point three.

                            Whether one uses Fortran, Python, or any other language, all primitives
                            are eventually implemented in either C or assembly. At some point or
                            another, we end up scraping bare metal and silicon to get our answers.
                            The question then becomes, "How easily can I extend this language to fit
                            my needs." NumPy is evidence that at least a few people said "Easily
                            enough." I don't know how extensible Fortran is, but I would guess "very"
                            since I've heard of it being applied in many domains other than numerical
                            processing. (OpenFirmware, for example.)

                            So, I guess that my point is that C might not be the right language for
                            doing numerical processing, but it seems the right language for
                            implementing the primitives of numerical processing. Those primitives
                            should, of course, be designed in such a manner that their behaviors are
                            not muddied by pointer issues.

                            Moving on:
                            I think Python's strength flows from the three criterion for choosing a
                            language. It's semantics seem to naturally fit the way a programmer
                            thinks about problems. All the algorithmic primitives are there for
                            naturally expressing one's self easily. Where the primitives don't exist,
                            it's easy to bind outside primitives into the system seamlessly. One of
                            the joy's of python is that c extension libraries almost never feel bolted
                            on. They feel like an intimate part of the language itself. Part of that
                            is the blood, sweat and tears of the library implementors, but much of it
                            is also the elegance of Python.

                            As far as the straw-poll goes, I think it's a good question to ask, and
                            that the answer is important, but we also need to figure out where else we
                            can ask this question. The problem with asking such a question solely on
                            c.l.p is that everyone here has either decided that optimization in python
                            isn't enough of an issue to bother them, or hasn't made up their
                            mind yet. Those who have decided that optimization in python is a problem
                            have already gone elsewhere. Perhaps a better question to ask is "Who has
                            decided that Python is too slow for their needs, what prompted that
                            decision and are the issues they had worth addressing?"

                            Sam Walters.


                            --
                            Never forget the halloween documents.

                            """ Where will Microsoft try to drag you today?
                            Do you really want to go there?"""

                            Comment

                            • Rainer Deyke

                              #29
                              Re: Python is far from a top performer according to benchmark test...

                              Samuel Walters wrote:[color=blue]
                              > So, I guess that my point is that C might not be the right language
                              > for doing numerical processing, but it seems the right language for
                              > implementing the primitives of numerical processing.[/color]

                              The issue with C is that it is too slow for implementing those primitives
                              (in part due to pointer aliasing issues). Fortran is considerably faster.


                              --
                              Rainer Deyke - rainerd@eldwood .com - http://eldwood.com


                              Comment

                              • Samuel Walters

                                #30
                                Re: QOTW?

                                |Thus Spake Skip Montanaro On the now historical date of Sat, 10 Jan 2004
                                07:50:09 -0600|
                                [color=blue]
                                >
                                > QOTW perhaps?
                                >
                                > Sam> I read the benchmark and I think it doesn't measure python in
                                > it's Sam> target area. That's like taking a world-class marathon
                                > runner and Sam> wondering why he doesn't compete well in a
                                > figure-skating event.
                                >
                                > Skip[/color]

                                *garsh*

                                I feel flattered. *blush*

                                You know, I sadly spent quite a bit of time debating which simile to use
                                there. I wandered around the house wondering what to put there.

                                Some rejected ideas:
                                "It's like asking Kasparov why he didn't win the weight-lifting
                                competition."

                                "That's like asking a world-class marathon runner why he doesn't compete
                                well in a weight-lifting competition."

                                "That's like asking a world-class weightlifter why they didn't do well in
                                the figure skating competition." (I almost used this one because it
                                conjures images of a burly Russian weight-lifter floundering on ice
                                skates. Very Monty-Python-esque.)

                                I chose the one I did in case I needed to later state that "Both figure
                                skating and marathon running are aerobic sports, but that doesn't mean
                                that the skills involved are the same."

                                ..

                                Now, I feel compelled to justify my statement.

                                Let's look closely at the benchmarks and try to figure out if there's a
                                good reason why we fell down where we did.

                                We did poorly at Math, and competitively at I/O.

                                I'm reminded of Antoine de Saint-Exupe'ry saying "A designer knows he has
                                achieved perfection not when there is nothing left to add, but when there
                                is nothing left to take away." While not part of the Zen of Python, this
                                seems to be an unstated principle of Python's design. It seems to focus
                                on the bare minimum of what's needed for elegant expression of algorithms,
                                and leave any extravagances to importable libraries.

                                Why, then, are integers and longs part of Python itself, and not part of a
                                library? Well, we need such constructs for counters, loops and indexes.
                                Both range and xrange are evidence of this. Were it not for this, I
                                daresay that we'd have at least argued the necessity of keeping these
                                things in the language itself.

                                Floats are a pragmatic convenience, because it's nice to be able to throw
                                around the odd floating point number when you need to. Trig functions are
                                housed in a separate library and notice that we didn't do too shabby there.

                                I/O is one of our strengths, because we understand that most programs are
                                not algorithmically bound, but rather I/O bound. I/O is a big
                                bottle-neck, so we should be damn good at it. The fastest assembly
                                program won't do much good if it's always waiting on the disk-drive.

                                Perhaps our simplicity is the reason we hear so many Lisp'ers vocally
                                complaining. While more pragmatic than Lisp, Python is definitely edging
                                into the "Lambda Calculus Zone" that Lisp'ers have historically been the
                                proud sole-occupants of. After all, until Python, when one wanted a
                                nearly theoretical programming experience, one either went to C/Assembly
                                (Turing Machine Metaphor) or Lisp (Lambda Calculus Metaphor.)

                                Python is being used in so many introductory programming courses for the
                                very reason that it so purely fits the way a programmer thinks, while
                                still managing to be pragmatic. It allows for a natural introduction to
                                some of the hardest concepts: Pointers/Reference, Namespaces, Objects and
                                Legibility. Each of these concepts is difficult to learn if you are first
                                indoctrinated into an environment without them. In my attempts to learn
                                C++, I initially felt like I was beating my head up against a wall trying
                                to learn what an object was and why one would use them. I have since
                                observed that people coming from a strongly functional programming
                                background have the same experience, while those with no functional
                                programming dogma in them find objects quite a natural concept. The same
                                thing is true of the other concepts I mentioned. If you have them, it's
                                easy to work without them. If you don't, you'll flounder trying to pick
                                them up. Think about how easy it is to pick out a C programmer from their
                                Python coding style.

                                The one important concept I didn't mention is message-passing. This is an
                                important, but much less used concept. It is the domain of Smalltalk and
                                Ruby. I've looked some at Ruby, and lurk their Usenet group. From what I
                                can tell, Ruby takes almost the same philosophy as Python, except where we
                                think namespaces are a honking great idea, they think message-passing is a
                                honking great idea. The nice thing about message-passing is that if you
                                have all the other concepts of OO down, message passing seems natural and
                                is not terribly difficult to "fake" when it's the only missing OO
                                primitive. This is why C++, while not a message-based OO language, is
                                used so often in GUI's, an inherently message-based domain. This is also
                                why we have such a nice, broad choice of GUI toolkits under Python despite
                                lacking a message primitive.


                                Well, I've blathered enough on this topic.
                                I hope, at least, that I've said something worthwhile.
                                Though, I doubt I've said anything that hasn't been said better before.

                                Caffeine, Boredom and Usenet are a dangerous mix.

                                Sam Walters.


                                --
                                Never forget the halloween documents.

                                """ Where will Microsoft try to drag you today?
                                Do you really want to go there?"""

                                Comment

                                Working...