News for hackers. Stuff that matters.
Re:What's up, Python? The GIL removed, a new compiler, optpa... by jeremycarter on Sunday July 30, 2023 @05:21PM (#36936116)
Similar experience. Even with multi process and threads python is slow, very slow. Java, Go and .NET all provide a very performant out of box experience.
Re:What's up, Python? The GIL removed, a new compiler, optpa... by __d on Sunday July 30, 2023 @07:27PM (#36937095)
Python is both an interpreter, and quite dynamic. Both of these lead to lower performance when compared to less dynamic, compiled solutions. All of Java, Go, and .NET are compiled and (much) less dynamic.

This is absolutely an expected outcome.

Re:What's up, Python? The GIL removed, a new compiler, optpa... by cypress66 on Sunday July 30, 2023 @07:40PM (#36937200)
Node is pretty performant for anything IO related, not compiled and reasonably dynamic.
Re:What's up, Python? The GIL removed, a new compiler, optpa... by __d on Sunday July 30, 2023 @09:22PM (#36937863)
I think it's worth the clarification that Javascript is usually JITed; (C)Python isn't.

And that CPython's I/O isn't really the problem: some of its async event loop implementations are fairly competitive with Node.

But still ... yes.

Javascript has benefited from two decades of intensive, well-funded work by the best people in the business, with clear focus on performance as a high priority goal. Not to take away from those who work on Python, but I think it's fair to say the effort has had orders of magnitude difference.

I don't have a deep enough understanding to say whether the nature of Python or Javascript makes one better suited for performance optimization than the other. Python is perhaps able to benefit from seeing what's been done with Javascript, although of course Javascript has stood on the shoulders of its own giants.

Re:What's up, Python? The GIL removed, a new compiler, optpa... by mike_ivanov on Sunday July 30, 2023 @07:54PM (#36937309)
"absolutely an expected outcome."

Good day. Is it the right time to talk to you about Common Lisp?

Re:What's up, Python? The GIL removed, a new compiler, optpa... by __d on Sunday July 30, 2023 @09:13PM (#36937827)
Always a good time.
Re:What's up, Python? The GIL removed, a new compiler, optpa... by tsimionescu on Monday July 31, 2023 @01:22AM (#36939075)
To be fair, if you use CL in a similarly dynamic way as Python (don't compile anything, don't add any declarations etc) it won't be that much faster. You'll get some boost out of the stdlib stuff being compiled already, but otherwise it will incur similar performance penalties.
Re:What's up, Python? The GIL removed, a new compiler, optpa... by pjmlp on Monday July 31, 2023 @05:37AM (#36940385)
We can add Smalltalk, SELF, Dylan, JavaScript into the discussion then.
Re:What's up, Python? The GIL removed, a new compiler, optpa... by __d on Monday July 31, 2023 @08:43AM (#36941753)
And maybe Strongtalk
Re:What's up, Python? The GIL removed, a new compiler, optpa... by pjmlp on Monday July 31, 2023 @11:06AM (#36943734)
Kind of, I left it out on purpose, as it was designed with strong typing in mind, and I only wanted to list dynamic languages with good JIT support.
Re:What's up, Python? The GIL removed, a new compiler, optpa... by gpderetta on Sunday July 30, 2023 @09:14PM (#36937829)
These days even elisp can be compiled. I think python need to be dragged kicking and screaming into cutting edge '80s dynamic compilation technology.
Re:What's up, Python? The GIL removed, a new compiler, optpa... by __d on Sunday July 30, 2023 @09:30PM (#36937902)
I'm sure skilled volunteers would be very welcome.

There are numerous active, moderately serious efforts to both optimize and/or JIT Python bytecode. I think AOT compilation is mostly out-of-scope for 100% compatibility, but again, there's lots of different efforts to compile either subset languages or subsets of programs.

"Kicking and screaming" suggests some reluctance to embrace this, but I think that's probably unfair: it's just hard.

Re:What's up, Python? The GIL removed, a new compiler, optpa... by pjmlp on Monday July 31, 2023 @05:39AM (#36940395)
It isn't as if PyPy doesn't exist. Embracing it during the 16 years of its existence is another matter.
Re:What's up, Python? The GIL removed, a new compiler, optpa... by ActorNightly on Sunday July 30, 2023 @08:01PM (#36937370)
3.11 and on should be comparable to Java for most use cases with multiprocessing (set up correctly of course)
Re:What's up, Python? The GIL removed, a new compiler, optpa... by geysersam on Sunday July 30, 2023 @09:07PM (#36937801)
How do you mean? 3.11 is something like 10-20% faster than earlier Python releases. Why should that make it comparable to Java? Typically Java is still several times faster than Python, and this is totally natural since Java performance benefits from static type declarations and the language is generally less dynamic than Python.

That said I still use Python for CPU intensive tasks since in my experience Numpy/Scipy/Numba etc does a good job speeding up the CPU intensive parts of Python code.

Re:What's up, Python? The GIL removed, a new compiler, optpa... by oivey on Sunday July 30, 2023 @10:00PM (#36938044)
Static type declarations don't make Java fast. The compiler does. Dynamically typed languages with no type declarations can be very fast if the compiler can infer the types.

That's not to say that Python will ever get there. My understanding is that the design of the language and leaky implementation details make generally compiling Python to fast machine code nearly impossible.

Re:What's up, Python? The GIL removed, a new compiler, optpa... by TillE on Sunday July 30, 2023 @10:23PM (#36938153)
Well, we already have a mature, real-world Python JIT in PyPy, with impressive performance.

I dunno if Python is ever gonna be as fast as Java or C#, but we know it can be much better.

Re:What's up, Python? The GIL removed, a new compiler, optpa... by metadat on Sunday July 30, 2023 @11:34PM (#36938552)
I can't find any benchmarks of PyPy vs OpenJDK or GraalVM, but unless I'm mistaken it's still more than 100% difference, and maybe much, much more for pure-Python vs. Java.
Re:What's up, Python? The GIL removed, a new compiler, optpa... by mattip on Monday July 31, 2023 @12:54AM (#36938948)
Here ya go. On these sometimes one is faster, sometimes the other. https://github.com/kostya/jit-benchmarks/blob/master/README.... Personally i don’t like such comparisons. Benchmarking is hard and far from objective. Much of what makes python popular is the developer experience. Generic benchmarks will only give a rough guide about what to expect in your application. If you are in a niche like the OP, you will have to figure out how to handle your bottlenecks.
Re:What's up, Python? The GIL removed, a new compiler, optpa... by metadat on Monday July 31, 2023 @01:05AM (#36938993)
Eagerly awaiting no-Gil Flask vs. Dropwizard performance analysis.