why python is slower than java?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • G. S. Hayes

    #91
    Re: why python is slower than java?

    finite.automato n@gmail.com (Lonnie Princehouse) wrote in message news:<4b39d922. 0411051555.24f3 1663@posting.go ogle.com>...[color=blue]
    > Yes, wxPython is typically quicker than swing. It's not fair to use
    > this in a generic Python-vs-Java speed shootout, though, since
    > wxPython is just a wrapper around wxWidgets' C++ code; you're really
    > comparing C++ vs. Java here.[/color]

    But the ease of development of extensions in other languages and the
    willingness of the community to do so IS one of the key differences
    between Java and Python, especially with respect to performance.
    Where Java tends to be platform independent, Python tends to be
    platform agnostic. In real code, people use SciPy/NumPy, wxpython,
    etc because those things work for them and get the job done.

    Moreover, since the GUI developer in Python is writing only in Python
    (never touching C++ or needing to know about it at all), you're
    basically saying that this example is unfair because Python has a
    faster implementation.

    Comment

    • Lonnie Princehouse

      #92
      Re: why python is slower than java?

      Mike Meyer <mwm@mired.or g> wrote in message news:<x7u0s3r9g z.fsf@guru.mire d.org>...[color=blue]
      > finite.automato n@gmail.com (Lonnie Princehouse) writes:
      >[color=green]
      > > Yes, wxPython is typically quicker than swing. It's not fair to use
      > > this in a generic Python-vs-Java speed shootout, though, since
      > > wxPython is just a wrapper around wxWidgets' C++ code; you're really
      > > comparing C++ vs. Java here.[/color]
      >
      > Is it unfair to compare Python dictionaries to Java HashTables because
      > Python is using hand-tuned C where Java is using Java? I'd say that's
      > a perfectly fair comparison. If that's fair, what's unfair about
      > comparing graphics toolkits that happen to be written in C rather than
      > Python (is there a graphics toolkit written in Python?).
      >[/color]

      Perhaps instead of "unfair", I should have written "not meaningful".
      Because wxPython is C++ code, you can't really infer that Python is
      faster than Java just because wxPython is faster than Swing. The
      best meaningful assertion that can be made is that Python can be
      faster than Java for GUI operations.
      [color=blue]
      > That's *how* interpreted languages manage to compete with compiled
      > languages - they perform the common operations in hand-tuned compiled
      > code. That people tend to write Java libraries in Java rather than C
      > just means they're going to get slower libraries.[/color]

      Sure, but it's possible to do the same thing with Java via the JNI.
      Maybe what should be compared is the relative ease of writing native
      extensions (considerably easier in Python IMHO)
      [color=blue]
      > Java is interpreted just like Python is...[/color]

      Java bytecodes are interpreted, but javac has the opportunity to do
      some optimizations when compiling source into bytecodes that
      fundamentally can't be done for Python because it's interpreted.
      There's no equivalent of "exec" in Java. Psyco makes a valiant
      attempt to do this sort of optimization (and does an excellent job!),
      but it's not hard to write perfectly legal Python code that makes
      Psyco explode.

      [someone correct me if I'm wrong; I'm not an expert Java programmer
      :P]

      Comment

      • tutu

        #93
        Re: why python is slower than java?

        Maurice LING <mauriceling@ac m.org> wrote in message[color=blue]
        > 3. I am not interested in the amount of time needed to develop it. But
        > only interested execution speed.[/color]

        -If you really don't care about it, spend time developing it in C or
        asambler or machine code, is it going to be faster, maybe?
        -If you really don't care about it, write it in both, Java and Python
        and decide for yourself about the speed.
        -Do you honestly believe someone here can make those valid statements
        you are waiting for to validate your unspoken reasons of this dilemma?

        Here is how it goes:
        No matter what others are going to try and persuade you about, you
        will only make it right and probably fast enough when you will have
        the experience to do it. Do you know Java better? go ahead and write
        it in Java. Are you willing to learn Python and see for yourself if
        the decision was right, I suggest you do that, I believe it should be
        worthy. Are you afraid you are going to make the wrong decision?. You
        must be mature and assume your decisions.

        So, if you do have time my suggestion is:
        Go ahead and try a few things in python (it seams you have some
        reasons to do that already) and see if they are going to perform the
        way you would like and if yes, make a plan and do it.
        Success!!!

        If it is not what you expected, do it in Java.
        Success!!!

        If you want to see reactions like the one from that Pythongoras, go
        ahead and wait some more.

        Comment

        • Isaac To

          #94
          Re: why python is slower than java?

          >>>>> "Tim" == Tim Roberts <timr@probo.com > writes:

          Tim> It is fabulous that you are able to enumerate your list of
          Tim> requirements so completely. I'm quite serious; many people
          Tim> embark on even complicated projects without a clear
          Tim> understanding of the tradeoffs they will encounter.

          Tim> However, given that set of needs, why would you mess with an
          Tim> "exotic" language at all? Why wouldn't you just write
          Tim> straight to the metal in C++ or C? -- - Tim Roberts,
          Tim> timr@probo.com Providenza & Boekelheide, Inc.

          It is quite possible that the list of features, requirements, etc.,
          are all known only after the Python prototype show that it worked.
          Very few people (except those who are really very proficient in C++)
          would like to write prototypes in such static languages, but once the
          prototype show what is needed, and the prototype becomes part of the
          production system, one have to step by step turn it back to C++.

          Regards,
          Isaac.

          Comment

          • Dave Cook

            #95
            Re: why python is slower than java?

            In article <87d5ysbkq9.fsf @pop-server.bigpond. net.au>, Israel Raj T wrote:
            [color=blue]
            > On Windows XP, Windows NT and Linux (Gentoo ), I have consistently
            > found python apps using wxpython to be far faster to load
            > and to be far more responsive than Java apps.[/color]

            I've casually compared the jython/Swing tree widget with the pygtk tree
            widget, both with the same large data set, and the Swing tree widget
            responds quite a bit faster than the gtk tree widget (there have been a lot
            of complaints about the gtk treeviews slowness). Obviously the Swing tree
            widget is much better optimized.

            wxpython runs on top of gtk on Linux, but I don't know if they use the gtk
            treeview as a "peer" or work around it and implement their own tree widget.

            Dave Cook

            Comment

            • Jacek Generowicz

              #96
              Re: why python is slower than java?

              finite.automato n@gmail.com (Lonnie Princehouse) writes:
              [color=blue]
              > Yes, wxPython is typically quicker than swing. It's not fair to use
              > this in a generic Python-vs-Java speed shootout, though, since
              > wxPython is just a wrapper around wxWidgets' C++ code; you're really
              > comparing C++ vs. Java here.[/color]

              And Python's list.sort is just a wrapper around C code. So I guess
              that it's not fair to use that, or any other Python built-in function,
              in a Python-vs-X speed shootout. This would mean you can't use Python
              classes in such a shootout either, as type.__new__ and object.__new__
              are both also merely wrappers around C code ... not to mention Python
              dictionaries: wrappers around C code which are used in just about
              every name lookup in Python.

              So, the conclusion is that it's not fair to use Python in a
              Python-vs-X speed shootout.

              I rather like that conclusion :-)

              Comment

              • Lonnie Princehouse

                #97
                Re: why python is slower than java?

                Hehe. I'm really not trying to start a flame war, honest :P
                I don't even like Java.

                My point was just that it's sort of misleading to say "wxPython is
                faster than Swing, therefore Python tends to be faster than Java for
                all things".


                Jacek Generowicz <jacek.generowi cz@cern.ch> wrote in message news:<tyffz3j2m i2.fsf@pcepsft0 01.cern.ch>...[color=blue]
                > finite.automato n@gmail.com (Lonnie Princehouse) writes:
                >[color=green]
                > > Yes, wxPython is typically quicker than swing. It's not fair to use
                > > this in a generic Python-vs-Java speed shootout, though, since
                > > wxPython is just a wrapper around wxWidgets' C++ code; you're really
                > > comparing C++ vs. Java here.[/color]
                >
                > And Python's list.sort is just a wrapper around C code. So I guess
                > that it's not fair to use that, or any other Python built-in function,
                > in a Python-vs-X speed shootout. This would mean you can't use Python
                > classes in such a shootout either, as type.__new__ and object.__new__
                > are both also merely wrappers around C code ... not to mention Python
                > dictionaries: wrappers around C code which are used in just about
                > every name lookup in Python.
                >
                > So, the conclusion is that it's not fair to use Python in a
                > Python-vs-X speed shootout.
                >
                > I rather like that conclusion :-)[/color]

                Comment

                • Jeff Shannon

                  #98
                  Re: why python is slower than java?

                  Dave Cook wrote:
                  [color=blue]
                  >wxpython runs on top of gtk on Linux, but I don't know if they use the gtk
                  >treeview as a "peer" or work around it and implement their own tree widget.
                  >
                  >[/color]

                  Given that the express goal of wxWidgets is to use native widgets
                  wherever possible (a goal which results in some cross-platform
                  inconsistencies , but is largely responsible for its "better" (i.e.
                  native) look and usually-better speed), I'd think it very likely that it
                  does use the GTK treeview.

                  Jeff Shannon
                  Technician/Programmer
                  Credit International


                  Comment

                  • Alex Martelli

                    #99
                    Re: why python is slower than java?

                    Lonnie Princehouse <finite.automat on@gmail.com> wrote:
                    [color=blue][color=green]
                    > > Java is interpreted just like Python is...[/color]
                    >
                    > Java bytecodes are interpreted, but javac has the opportunity to do
                    > some optimizations when compiling source into bytecodes that
                    > fundamentally can't be done for Python because it's interpreted.[/color]

                    This assertion is, simply, wrong. The Python compiler has the
                    opportunity to perform plenty of optimizations, too. If it only
                    performs a very few of them is most definitely _NOT_ "because it's
                    interpreted": Python is interpreted just as much as Java is.
                    [color=blue]
                    > There's no equivalent of "exec" in Java.[/color]

                    ....so on any function containing an 'exec', even the few key
                    optimizations the Python compiler does are turned off. So what?
                    Doesn't mean they have to be turned off in normal, sane functions which
                    simply to NOT use 'exec'.

                    The fact that optimizations are turned off is one of many excellent
                    reasons to avoid USING Python's exec, btw.
                    [color=blue]
                    > Psyco makes a valiant
                    > attempt to do this sort of optimization (and does an excellent job!),
                    > but it's not hard to write perfectly legal Python code that makes
                    > Psyco explode.[/color]

                    I wouldn't be surprised if psyco had bugs: so did the first several
                    generations of Java JITs, even with a couple more orders of magnitude of
                    people slaving away on them than have worked on psyco. That has nothing
                    to do with "being interpreted" somehow differing between Java and
                    Python.


                    Alex

                    Comment

                    • Steve Holden

                      Re: why python is slower than java?

                      Jeremy Bowers wrote:[color=blue]
                      > On Sat, 06 Nov 2004 20:53:26 +0000, Israel Raj T wrote:
                      >[color=green]
                      >>As for non desktop apps, the entire portage system of Gentoo is written in
                      >>Python. 'emerge sync' causes a python app to synchronise a local
                      >>application database with database at a non-local mirror. It is i/o
                      >>intensive and appears to work very well and very fast.[/color]
                      >
                      >
                      > "emerge sync" mostly runs an rsync command (at least on standard
                      > installs). The python contribution to that process is minimal.
                      >
                      > The primary slowdown with "emerge" appears to be the way the database is
                      > stored as many thousands of little files in /usr/portage. Again, not
                      > really python; you want to accelerate emerge, speed up your hard drive.
                      >
                      > (They have more cached metadata now at least in the cutting-edge release,
                      > but as that is the one I use I don't know if that is now considered
                      > stable. It has really sped things up. A couple more iterations and Python
                      > might actually become the bottleneck.)[/color]

                      Jeremy:

                      I just noticed your date is set a month ahead.

                      regards
                      Steve
                      --


                      Holden Web LLC +1 800 494 3119

                      Comment

                      • Asun Friere

                        Re: why python is slower than java?

                        aleaxit@yahoo.c om (Alex Martelli) wrote in message news:<1gmueqr.1 hs16lxfjegpuN%a leaxit@yahoo.co m>...
                        [color=blue]
                        > [A]sking for tolerance and patience
                        > against _rude_ newbies which barge in with shrill, mostly unjustified,
                        > repetitious complaints, is, I think, a rather far-fetched request.[/color]

                        That request is in no way far-fetched if made to someone of great
                        personal maturity and character. Rudeness is hardly ever an effective
                        response to rudeness. So I'll make it: "Please be tolerant and
                        patient of newbies, _especially_ the rude ones." :p Remember it's the
                        audience, not merely the opponent you are addressing.

                        Be that as it may, Maurice's original question, while arguably founded
                        upon a false presumption, was in no way rude. Nor were his subsequent
                        posts (unless I missed one). The helpfulness of this newgroup should
                        be (and was) one of python's selling points. Certainly I learned much
                        here, and especially from your posts Alex, when I first started using
                        the language.

                        Comment

                        • Jacek Generowicz

                          Re: why python is slower than java?

                          finite.automato n@gmail.com (Lonnie Princehouse) writes:
                          [color=blue]
                          > Hehe. I'm really not trying to start a flame war, honest :P
                          > I don't even like Java.
                          >
                          > My point was just that it's sort of misleading to say "wxPython is
                          > faster than Swing, therefore Python tends to be faster than Java for
                          > all things".[/color]

                          OK, how about this:

                          C is faster than Java, and Python is just a wrapper around C, ergo
                          Python is faster than Java for all things.

                          :-) x 10

                          Comment

                          • Lonnie Princehouse

                            Re: why python is slower than java?

                            Jacek Generowicz <jacek.generowi cz@cern.ch> wrote in message news:<tyfbre62j gk.fsf@pcepsft0 01.cern.ch>...[color=blue]
                            > OK, how about this:
                            >
                            > C is faster than Java, and Python is just a wrapper around C, ergo
                            > Python is faster than Java for all things.
                            >
                            > :-) x 10[/color]


                            Works for me. It should also be noted that Python is _way_ more
                            Pythonic than Java is. :D

                            Comment

                            • Y2KYZFR1

                              Re: why python is slower than java?

                              Maurice LING <mauriceling@ac m.org> wrote in message news:<mailman.6 022.1099784038. 5135.python-list@python.org >...[color=blue][color=green]
                              > >
                              > > dude that "comparisio n" from twistedmatrix you refrence is ANCIENT!!![/color]
                              >
                              > I am wondering the impact when IBM decided that the base memory to not
                              > exceed 64kb, in the late 1960s...
                              >
                              > I suppose more experienced people in this list can agree that certain
                              > decisions made can be almost an edict. So, there is a re-building
                              > process every now and then, hopefully to by-pass such edicts. Python
                              > itself is already such an example.
                              >[color=green]
                              > >
                              > > it is comparing versions that are YEARS out of date and use![/color]
                              >
                              > Are the codebase of Python 1.5.2 and Java 1.1 totally replaced and
                              > deprecated?[/color]

                              yes it has, in both cases : proof again that you don't understand
                              enough to comprehend why your question is irrelevant, and that you
                              can't understand the answer as such.

                              you can't compare something from so many years ago to each other and
                              then EXTRAPOLATE the results to NOW.

                              It would be like comparing a 1965 Mustang to a 1965 Corvette and then
                              coming to the conclusion that you could EXTRAPLATE those results to
                              compare the 2005 models. Just completely lacking in any understanding
                              of scientific theory.
                              [color=blue]
                              > Lisp compiler is the 1st compiler to be created (according to the
                              > Red-Dragon book, I think) and almost all others are created by
                              > bootstrapping to LISP compiler. What are the implications of design
                              > decisions made in LISP compiler then affecting our compilers today? I
                              > don't know. I repeat myself, I DO NOT KNOW.
                              >[color=green]
                              > >
                              > > you are just trolling or your don't know enough to understand the
                              > > answer to your question which is way to vague to be answered, as there
                              > > is no real correct answer.[/color]
                              >
                              > Certainly I do not have 15 PhDs in computer science or computating
                              > mathematics.... .. I suppose there are some syntax error in your
                              > statement to allow me to parse it completely. "too vague", not "to vague".[/color]

                              an this just proves that YOU are irrelvant also, go troll somewhere
                              else. PLONK
                              [color=blue]
                              > Thanks
                              > maurice[/color]

                              Comment

                              • John Machin

                                Re: why python is slower than java?

                                Hans Nowak <hans@zephyrfal con.org> wrote in message news:<418C0DB6. 1040007@zephyrf alcon.org>...[color=blue]
                                > John Machin wrote:
                                >[color=green]
                                > > Or is this a joke/troll?? I can't believe the "unimelb.edu.au "; surely
                                > > a forgery.[/color]
                                >
                                > Is it just me, or is the climate in c.l.py getting less friendly to
                                > newbies? In any case,
                                > http://www.zoology.unimelb.edu.au/staff/nicholas.htm mentions Maurice
                                > Ling as an honor student.[/color]

                                No it doesn't. It says "honours student", which indicates solely the
                                enrolment status, with none of the connotations of merit that might be
                                attached to the American phrase "honor student".

                                To the main point: I apologise profusely to the whole world for
                                starting the thread of the month by not putting "Please turn your
                                irony detectors on" at the top of my post.

                                Comment

                                Working...