Python versus Perl ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Maas

    #16
    Re: Python versus Perl ?

    beliavsky@aol.c om schrieb:[color=blue]
    > His survey of programming languages in "The Art of Unix Programming",
    > available at
    > http://www.catb.org/~esr/writings/ta...eschapter.html , is
    > interesting (and biased). Raymond evaluates C, C++, Shell, Perl, Tcl,
    > Python, Java, and Emacs Lisp.[/color]

    One part of this survey strikes me:

    esr> In fact it's generally thought to be the least efficient and
    esr> slowest of the major scripting languages, a price it [Python]
    esr> pays for runtime type polymorphism.

    If I assume Perl, Python, Ruby, Tcl and PHP to be major scripting
    languages some benchmarks (http://dada.perl.it/shootout and
    http://shootout.alioth.debian.org) show that Python is probably the
    fastest among these (Perl is 25% faster at regex matching).

    --
    -------------------------------------------------------------------
    Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
    E-mail 'cGV0ZXIubWFhc0 BtcGx1c3IuZGU=\ n'.decode('base 64')
    -------------------------------------------------------------------

    Comment

    • m

      #17
      Re: Python versus Perl ?

      Courageous wrote:[color=blue]
      >[color=green]
      >>If Python is better than Perl, I'm curious how really significant
      >>those advantages are ?[/color][/color]

      speedwise, i think perl is faster than python and python performed the
      slowest as shown in http://www.flat222.org/mac/bench/

      Comment

      • Fredrik Lundh

        #18
        Re: Python versus Perl ?

        m" <m@m.com> wrote:
        [color=blue][color=green][color=darkred]
        >>>If Python is better than Perl, I'm curious how really significant
        >>>those advantages are ?[/color][/color]
        >
        > speedwise, i think perl is faster than python and python performed the slowest as shown in
        > http://www.flat222.org/mac/bench/[/color]

        if you use Python mostly to write empty loops, your programming license
        should be revoked. the benchmark author seems to have realized that, as
        can be seen from the "it's dead" paragraph at the top of the page, which
        makes me wonder why you posted this link...

        </F>



        Comment

        • m

          #19
          Re: Python versus Perl ?

          Fredrik Lundh wrote:
          [color=blue]
          > if you use Python mostly to write empty loops, your programming license
          > should be revoked. the benchmark author seems to have realized that, as
          > can be seen from the "it's dead" paragraph at the top of the page, which
          > makes me wonder why you posted this link...
          >
          > </F>[/color]

          i was trying to decide whether i needed perl or python for some work
          that i had to get done and was seeing which was faster. and came across
          this link which i tht was pertinent. is python as fast as perl for the
          nonempty loops that the author wrote?

          Comment

          • Irmen de Jong

            #20
            Re: Python versus Perl ?

            m wrote:[color=blue]
            > Fredrik Lundh wrote:
            >[color=green]
            >> if you use Python mostly to write empty loops, your programming license
            >> should be revoked. the benchmark author seems to have realized that, as
            >> can be seen from the "it's dead" paragraph at the top of the page, which
            >> makes me wonder why you posted this link...
            >>
            >> </F>[/color]
            >
            >
            > i was trying to decide whether i needed perl or python for some work
            > that i had to get done and was seeing which was faster. and came across
            > this link which i tht was pertinent. is python as fast as perl for the
            > nonempty loops that the author wrote?[/color]

            Why do you care?
            Have you read http://www.python.org/moin/PythonSpeed ?

            --Irmen

            Comment

            • Reinhold Birkenfeld

              #21
              Re: Python versus Perl ?

              Fredrik Lundh wrote:[color=blue]
              > m" <m@m.com> wrote:
              >[color=green][color=darkred]
              >>>>If Python is better than Perl, I'm curious how really significant
              >>>>those advantages are ?[/color]
              >>
              >> speedwise, i think perl is faster than python and python performed the slowest as shown in
              >> http://www.flat222.org/mac/bench/[/color]
              >
              > if you use Python mostly to write empty loops, your programming license
              > should be revoked. the benchmark author seems to have realized that, as
              > can be seen from the "it's dead" paragraph at the top of the page, which
              > makes me wonder why you posted this link...[/color]

              Especially when you read

              """
              I found the performance of Python for these benchmarks really surprising
              as it is at odds to my everyday experience.
              """

              you will seriously think about the benchmark's significance.

              Reinhold

              Comment

              • Caleb Hattingh

                #22
                Re: Python versus Perl ?

                Hi m

                Speed is a contentious issue here. Point is, if you really need raw
                speed, why stop only at Perl and Python? There are plenty of statically
                compiled languages that will produce native binaries.

                The relative difference in speed between Perl and Python, whatever it is,
                is completely washed out by the enormous jump using, say, C for example
                [please, everyone else, I am aware of all the mitigating circumstances
                regarding, e.g. parts of the standard library written in C, etc. That is
                not my point.]

                A Good Reason for thinking along these lines (Perl/Python) is more
                something like speed and reliability of development. Another one is
                maintaintabilit y. I must confess that I know pretty much nothing about
                Perl, so I can't comment about that. My opinion about Python is that it
                is very, very good for these things.

                The problem domains in which I do most of my work (chemical process
                modelling and simulation) really do require speed. That's why I mostly
                use Delphi (i.e. reasonably fast code) at work. I believe I know when
                speed is and is not an issue, and (by far) most of the time, my experience
                is that it is *not*. So I use Delphi for numerical code and python for
                everything else.

                You really will have to convince people here that execution speed is a
                real issue for your programming task (in order to continue this
                discussion). Otherwise the debate will go south real quick.

                Keep well
                Caleb


                On Tue, 08 Feb 2005 12:17:05 -0600, m <m@m.com> wrote:
                [color=blue]
                > Courageous wrote:[color=green]
                >>[color=darkred]
                >>> If Python is better than Perl, I'm curious how really significant
                >>> those advantages are ?[/color][/color]
                >
                > speedwise, i think perl is faster than python and python performed the
                > slowest as shown in http://www.flat222.org/mac/bench/[/color]

                Comment

                • m

                  #23
                  Re: Python versus Perl ?

                  Irmen de Jong wrote:[color=blue]
                  > m wrote:[/color]
                  [color=blue]
                  > Why do you care?
                  > Have you read http://www.python.org/moin/PythonSpeed ?
                  >
                  > --Irmen[/color]
                  i had not read it. thanks for pointing it out!

                  Comment

                  • m

                    #24
                    Re: Python versus Perl ?

                    <snip>
                    You really will have to convince people here that execution speed is a[color=blue]
                    > real issue for your programming task (in order to continue this
                    > discussion). Otherwise the debate will go south real quick.
                    >
                    > Keep well
                    > Caleb
                    >
                    >
                    > On Tue, 08 Feb 2005 12:17:05 -0600, m <m@m.com> wrote:
                    >[color=green]
                    >> Courageous wrote:
                    >>[color=darkred]
                    >>>
                    >>>> If Python is better than Perl, I'm curious how really significant
                    >>>> those advantages are ?[/color]
                    >>
                    >>
                    >> speedwise, i think perl is faster than python and python performed
                    >> the slowest as shown in http://www.flat222.org/mac/bench/[/color]
                    >
                    >[/color]

                    i have nothing else to add. thanks caleb!

                    Comment

                    • Adam DePrince

                      #25
                      Re: Python versus Perl ?

                      On Tue, 2005-02-08 at 22:44, Caleb Hattingh wrote:[color=blue]
                      > Hi m
                      >
                      > Speed is a contentious issue here. Point is, if you really need raw
                      > speed, why stop only at Perl and Python? There are plenty of statically
                      > compiled languages that will produce native binaries.
                      >
                      > The relative difference in speed between Perl and Python, whatever it is,
                      > is completely washed out by the enormous jump using, say, C for example
                      > [please, everyone else, I am aware of all the mitigating circumstances
                      > regarding, e.g. parts of the standard library written in C, etc. That is
                      > not my point.][/color]

                      I think the expression you seek is "comparing virtue among whores."

                      Now we can all acknowledge that there is a spectrum in the programmer
                      time vs machine time trade-off. (Voice reader users: Please forgive my
                      ASCII art ... imagine a data set that loosely fits a linear relationship
                      with a negative slope.)

                      ASCII art start

                      +
                      M|*
                      A| * *
                      C| *
                      H| * "STUPID"
                      I| * *
                      N| *
                      E| *
                      | *
                      C| * *
                      O| "Holy *
                      S| Grail" *
                      T| *
                      0------------------------- +
                      PROGRAMMER COST

                      ASCII art stop

                      This metric is actually in two dimensions, but we usually consider it in
                      one dimension with High Machine cost and low programmer cost at one
                      extreme and low machine cost and high programmer cost at the other
                      extreme.

                      ASCII art start

                      High Machine <---------------> High Programmer Cost

                      ASCII art stop

                      because there is a high inverse correlation between programmer and
                      machine costs. Only a fool would use a programing language in the
                      "stupid" area of the above chart (both costs high). Likewise, nobody
                      gets to use the language that does not exist in the "Holy Grail" area of
                      the chart (both costs low.)

                      Both Python and Perl are way up in the upper left ( machine cost high,
                      programmer cost low) of my little chart. Perl has much magic that
                      drives up its programmer cost. Not by much in the know, but by enough
                      that I would consider it to have a slightly higher programmer cost than
                      Python. If Perl code executes a bit faster, then fine, all I can say is
                      "that's nice." If machine costs were an issue I'd recode in vhdl and
                      compile to silicone.

                      Of the topic I want to address, you can entirely circumvent those
                      issues by coding in C and using the Python C-API instead of strcmp and
                      friends.


                      [color=blue]
                      >
                      > A Good Reason for thinking along these lines (Perl/Python) is more
                      > something like speed and reliability of development. Another one is
                      > maintaintabilit y. I must confess that I know pretty much nothing about
                      > Perl, so I can't comment about that. My opinion about Python is that it
                      > is very, very good for these things.
                      >
                      > The problem domains in which I do most of my work (chemical process
                      > modelling and simulation) really do require speed. That's why I mostly
                      > use Delphi (i.e. reasonably fast code) at work. I believe I know when
                      > speed is and is not an issue, and (by far) most of the time, my experience
                      > is that it is *not*. So I use Delphi for numerical code and python for
                      > everything else.[/color]

                      Why don't you use C for the numerical work? Then you can do your number
                      crunching within a c-based python module. Have your cake and ...
                      [color=blue]
                      >
                      > You really will have to convince people here that execution speed is a
                      > real issue for your programming task (in order to continue this
                      > discussion). Otherwise the debate will go south real quick.[/color]

                      Not only most speed be an issue, but the economics must be such that any
                      alternative is better than throwing more hardware at the problem.

                      Adam DePrince


                      Comment

                      • Harlin

                        #26
                        Re: Python versus Perl ?

                        If you give it a good go, you will be amazed at how the text processing
                        is so much better than Perl's. The same with the object orientation
                        (what oop in Perl?? none... at least none worth mentioning :-) It's
                        been said before by many Python users... Python allows newbies to
                        program and wizards to be even more wizardly... or something to that
                        effect.

                        Comment

                        • Caleb Hattingh

                          #27
                          Re: Python versus Perl ?

                          Hi Adam

                          Thanks for your comments.
                          [color=blue]
                          > I think the expression you seek is "comparing virtue among whores."[/color]

                          Sure, that's what I was saying, but not quite in as colourfil a manner
                          :)
                          [color=blue][color=green]
                          > >
                          > > The problem domains in which I do most of my work (chemical process[/color][/color]
                          [color=blue][color=green]
                          > > modelling and simulation) really do require speed. That's why I[/color][/color]
                          mostly[color=blue][color=green]
                          > > use Delphi (i.e. reasonably fast code) at work. I believe I know[/color][/color]
                          when[color=blue][color=green]
                          > > speed is and is not an issue, and (by far) most of the time, my[/color][/color]
                          experience[color=blue][color=green]
                          > > is that it is *not*. So I use Delphi for numerical code and python[/color][/color]
                          for[color=blue][color=green]
                          > > everything else.[/color]
                          >
                          > Why don't you use C for the numerical work? Then you can do your[/color]
                          number[color=blue]
                          > crunching within a c-based python module. Have your cake and ...[/color]

                          As you might imagine, I think about this constantly. However, there
                          are many other issues that make it complicated, such as having to work
                          in a team where the average guy knows pascal well (we're just a bunch
                          of chemical engineers), but has never even heard of python. Plus, were
                          I to go this type of route, I would almost definitely code the binary
                          modules in Delphi or FreePascal, make a DLL and use ctypes to call it.
                          I do not know C and have no desire to learn now :) On the other
                          hand, I know pascal quite well.

                          keep well
                          Caleb

                          Comment

                          • chris

                            #28
                            Re: Python versus Perl ?

                            surfunbear@yaho o.com wrote:[color=blue]
                            > I've read some posts on Perl versus Python and studied a bit of my
                            > Python book.
                            >
                            > I'm a software engineer, familiar with C++ objected oriented
                            > development, but have been using Perl because it is great for pattern
                            > matching, text processing, and automated testing. Our company is[/color]
                            really[color=blue]
                            > fixated on risk managnemt and the only way I can do enough testing
                            > without working overtime (which some people have ended up doing) is[/color]
                            by[color=blue]
                            > automating my testing. That's what got me started on Perl.
                            >
                            > I've read that many people prefer Python and that it is better than
                            > Perl. However, I want to ask a few other questions.
                            >[/color]

                            This doesn't directly address your questions, but may be useful for
                            you, being a C++ programmer.



                            It is biased towards Python, obviously, but shows some practical
                            differences between Python and Perl that may be of interest.

                            -Chris

                            Comment

                            • Joe Francia

                              #29
                              Re: Python versus Perl ?

                              Caleb Hattingh wrote:[color=blue]
                              > As you might imagine, I think about this constantly. However, there
                              > are many other issues that make it complicated, such as having to work
                              > in a team where the average guy knows pascal well (we're just a bunch
                              > of chemical engineers), but has never even heard of python. Plus, were
                              > I to go this type of route, I would almost definitely code the binary
                              > modules in Delphi or FreePascal, make a DLL and use ctypes to call it.
                              > I do not know C and have no desire to learn now :) On the other
                              > hand, I know pascal quite well.
                              >
                              > keep well
                              > Caleb
                              >[/color]

                              You could always code Python extensions directly in Delphi:




                              Demo09 (look in demodll.dpr & module.pas) in the download tells you how.

                              Peace,
                              Joe

                              Comment

                              • Caleb Hattingh

                                #30
                                Re: Python versus Perl ?

                                Joe, thanks

                                Yes, I am on the P4D mailing list :) What you didn't say was that the
                                "python for delphi" extensions are *awesome*. full two-way communication,
                                and you get it all by drag&dropping a little component widget onto your
                                form in the IDE. Amazing.

                                However...

                                Dll's can be used by things other than python, which is the main reason
                                why we would go that route. However, with all the .NET hoopla, maybe
                                IronPython and a .NET dll would be the way to go in the future. I'm still
                                a little uneasy about adopting .NET as a standard just yet...

                                I should give it some more thought anyways.

                                Thanks again
                                Caleb

                                On Wed, 09 Feb 2005 12:38:37 -0500, Joe Francia
                                <gmane-schpam@joefranc ia.com> wrote:
                                [color=blue]
                                > Caleb Hattingh wrote:[color=green]
                                >> As you might imagine, I think about this constantly. However, there
                                >> are many other issues that make it complicated, such as having to work
                                >> in a team where the average guy knows pascal well (we're just a bunch
                                >> of chemical engineers), but has never even heard of python. Plus, were
                                >> I to go this type of route, I would almost definitely code the binary
                                >> modules in Delphi or FreePascal, make a DLL and use ctypes to call it.
                                >> I do not know C and have no desire to learn now :) On the other
                                >> hand, I know pascal quite well.
                                >> keep well
                                >> Caleb
                                >>[/color]
                                >
                                > You could always code Python extensions directly in Delphi:
                                >
                                > http://membres.lycos.fr/marat/delphi/python.htm
                                > http://www.atug.com/andypatterns/PythonDelphiLatest.htm
                                >
                                > Demo09 (look in demodll.dpr & module.pas) in the download tells you how.
                                >
                                > Peace,
                                > Joe
                                >[/color]

                                Comment

                                Working...