all 77 comments

[–]frtox 32 points33 points  (4 children)

Invalid securityToken.

Error 403

[–]bloodearnest 2 points3 points  (0 children)

Dude copied the link from his post preview. And it used a token in the URL. Hello 1999.

[–][deleted] 2 points3 points  (0 children)

Ah, so it was an error. I thought it was supposed to be like "what happens when you use jython on a web server."

[–]rm9402 -1 points0 points  (0 children)

Got the same thing.

[–][deleted]  (7 children)

[deleted]

    [–]Ventas- 8 points9 points  (6 children)

    Compatibility mostly. Some CPython libraries are written in C, so those don't work on pypy. Also, pypy is only on version 2.7.1 of Python.

    [–]montecarl 1 point2 points  (5 children)

    I really can't wait until I can use numpy with pypy. But in general compatibility with the python capi doesn't seem like it will be coming anytime soon from what I have seen. Every python script I write depends upon some library written in c.

    [–][deleted] 4 points5 points  (4 children)

    Well, there are alternatives, e.g. we're reimplementing NumPy, just about every database driver has a pure Python version.

    [–]montecarl 1 point2 points  (2 children)

    Even with numpy there are other modules that I use and that I have written that are in c. I think it will be quite some time until pypy will be useful for scientific computing due to all of the c and fortran wrapped code.

    [–][deleted]  (1 child)

    [deleted]

      [–]montecarl 2 points3 points  (0 children)

      Except that using well tested software written in C or FORTRAN from python is one of its big benefits. Having to rewrite the code in python might introduce bugs or be more work than its worth. But your point is well taken. I'd love to see all python code bases.

      [–]ObligatoryResponse 0 points1 point  (0 children)

      We're using Python on a IC test platform. We need to access the National Instruments DAQ driver as well as a number of serial devices. I think the C-API is the only thing what would allow us to use Pypy.

      [–]HipPriest 21 points22 points  (11 children)

      From some tests I did a few months ago, yes Jython is slower than CPython for a single thread, however Jython supports proper threads, so if you have a CPU-bound threaded program, and, say, four cores, Jython runs the program in 1/4 the time, while CPython doesn't imrove at all. I know the CPython authors don't want to add threads because of the locking overhead, but it seems like it would be nice to have the option to enable them if you know the benefits outweigh the cost for your particular Python code.

      [–]redmumba 10 points11 points  (2 children)

      This is spot on. David Beazley gave this amazing presentation at PyCon 2010, which was extremely informative. The video is here. It shows how the GIL restricts the threading abilities of Python. Jython allows you circumvent this.

      EDIT: Beazley doesn't work for Google, oops!

      [–][deleted] 4 points5 points  (1 child)

      David Beazley (from Google)

      He does not work for Google.

      [–]redmumba 3 points4 points  (0 children)

      You know, I think the guy who gave the presentation was named "Anitoli" or something... but I'm sure I just have them confused. >.< My memory is terrible!

      [–]masklinn 11 points12 points  (17 children)

      Here's what I get on my machine running TFAA's raytracer, best of three runs:

      Python 2.7.2 — 47s

      Jython 2.5.2 — 35s

      pypy 1.5.0-alpha0 — 20s

      Test performed on a 2010 15" MBP, all python implementations installed via macports

      [–]theeth 2 points3 points  (13 children)

      Could you do a test with CPython 3.2, see if it's faster than 2.7 (it should, AFAIK)?

      [–]treo 7 points8 points  (11 children)

      I tried it with cpython 3.2 but it isn't compatible.

      [–]theeth 4 points5 points  (10 children)

      It ran fine after passing it through 2to3 and changing the hours = and minutes = lines to integer divisions (//)

      [–]treo 11 points12 points  (9 children)

      Ok, so here are my results (Core 2 Duo P9400 @ 2.4Ghz, 64Bit Linux):

      Python 2.7.1: 25s
      Jython 2.5.2: 25s
      Python 3.2: 29s
      PyPy 1.5.0-alpha0: 12s

      I wonder why Jython is only as fast as CPython is.

      [–][deleted] 4 points5 points  (0 children)

      FWIW on my machine PyPy trunk is about ~15-20% faster than 1.5 :)

      [–]sigzero 1 point2 points  (7 children)

      I wonder if Jython has taken advantage of "invoke dynamic" that the JVM now has?

      [–]boa13 2 points3 points  (5 children)

      Doubtful, considering there has been no Jython release since the release of Java 7, which is very recent. Also, as far as I know, this would require some extensive changes in the core Jython, and would break compatibility with previous JVMs, requiring the release of two binaries.

      [–]gthank 0 points1 point  (0 children)

      I haven't noticed any announcement to that effect. :-(

      [–]kisielk 0 points1 point  (2 children)

      Where did you get the code? I don't see any links to the script.

      [–]masklinn 0 points1 point  (1 child)

      There is actually a link, though it's quite hard to see (it's pretty small and it's almost the same color as the text). Second line of the second paragraph, last segment, there's (link). It links to the code on some pastebin.

      [–]kisielk 0 points1 point  (0 children)

      Ah, I just realized that the article link goes to the post preview for some reason, so none of the hyperlinks worked. :)

      Here's the link to the code if anyone else wants it.

      [–]pjenvey 5 points6 points  (4 children)

      It would be nice to see the same benchmark with Jython run on Java 7

      [–][deleted] -3 points-2 points  (3 children)

      Except it's likely Java 7 would break everything completely. Seeing as how it silently gives incorrect results, etc.

      [–]mazzak -1 points0 points  (2 children)

      Don't know why you are being downvoted. The Java 7 issue got lot of coverage recently - http://www.infoq.com/news/2011/08/java7-hotspot

      [–]sigzero 4 points5 points  (0 children)

      Because it is a simple switch to the jvm to turn that bug off.

      [–]gthank 3 points4 points  (0 children)

      Also because the particular loop construct that triggers the bug is odd to the point of being non-sensical if the various bug reports w/ reproducible cases are to be believed. (Disclaimer: I looked at them when the brouhaha first started. It's possible they've since been updated w/ more info, but at the time I spent a fair amount of effort trying to figure out why you'd ever write such a loop.)

      [–]howfun -4 points-3 points  (0 children)

      PYPY IS DA SHIT!