Live data from Hacker News

Python 3.11 vs 3.10 performance

github.com

441–450 of 460 posts

Re: Python 3.11 vs 3.10 performance

#441

Earlier quoted context omitted.

They aren't, which is why the statement doesn't make sense haha. The difference is really just that tuples of isbits types can be stack allocated (and tuples of isbits types are isbits, so they can nest, etc.), and so in some cases with sufficiently small amounts of data, creating stack allocated objects is much faster than creating heap allocated objects. But if you compare concretely typed heap allocated arrays in…

My background is over 28 years of c++ programming 20 of that as my profession. My mistake in retrospect was using small arrays as part of a struct, which being immutable got replaced at each time step with a new struct requiring new arrays to be allocated and initialized. I would not have done that in c++, but julia puts my brain in matlab mode. If I had gone full matlab and just used a matrix or tensor instead of an…

> My mistake in retrospect was using small arrays as part of a struct, which being immutable got replaced at each time step with a new struct requiring new arrays to be allocated and initialized. I would not have done that in c++, but julia puts my brain in matlab mode.

I see. Yes, it's an interesting design space where Julia makes both heap and stack allocations easy enough, so sometimes you just reach for the heap like in MATLAB mode. Hopefully Prem and Shuhei's work lands soon enough to stack allocate small non-escaping arrays so that user's done need to think about this.

> Alignment I'd assumed, but padding the struct instead of the tuple did nothing, so probably extra work to clear a piece of an simd load. Any insight on why avx availability didn't help would be appreciated. I did verify some avx instructions were in the asm it generated, so it knew, it just didn't use.

The major differences at this point seem to come down to GCC (g++) vs LLVM and proofs of aliasing. LLVM's auto-vectorizer isn't that great, and it seems to be able to prove 2 arrays are not aliasing less reliably. For the first part, some people have just improved the loop analysis code from the Julia side (https://github.com/JuliaSIMD/LoopVectorization.jl), forcing SIMD onto LLVM can help it make the right choices. But for the second part you do need to do `@simd ivdep for ...` (or use LoopVectorization.jl) to match some C++ examples. This is hopefully one of the things that the JET.jl and other new analysis passes can help with, along with the new effects system (see https://github.com/JuliaLang/julia/pull/43852, this is a pretty huge new compiler feature in v1.8, but right now it's manually specified and will take time before things like https://github.com/JuliaLang/julia/pull/44822 land and start to make it more pervasive). When that's all together, LLVM will have more ammo for proving things more effectively (pun intended).

Re: Python 3.11 vs 3.10 performance

#442
post #433

Earlier quoted context omitted.

Oh that's like the US thing of saying something as "10 times less than ..." rather than "one tenth of ..."

Exactly that. I'm in the US and see it, but didn't know it was a US "thing". But yes, that.

It could also just be a new thing for English overall that I've associated more with the USA because I listen to or watch a lot of American podcasts, videos and streamers.

I'm not the type who gets worked up at American vs British English :-)

Re: Python 3.11 vs 3.10 performance

#444

Earlier quoted context omitted.

> 1. Python has never had that constraint Which is neither here, nor there. Python had another big constraint, the GIL. So threads there couldn't go so far as async would. But even environments with threads (C#, Rust) also got big into async in the same style. > 2. Python's asyncio in particular is a shitty hammer that only works on special asyncio-branded nails Well, that's also the case with C#, JS, and others with…

What has GIL to do with the thread model vs asyncio? asyncio is also single threaded, so cooperative (and even preemptive) green threads would have been a fully backward compatible option. JS never had an option as, as far as I understand, callback based async was already the norm, so async functions were an improvement over what came before. C# wants to be an high performance language, so using async to avoid alloca…

>What has GIL to do with the thread model vs asyncio?

Obviously the fact that the GIL prevents effient use of threads, so asyncio becomes the way to get more load from a single CPU by taking advantage of the otherwise blocking time.

Re: Python 3.11 vs 3.10 performance

#445
post #394

Earlier quoted context omitted.

That would be C++ and Fortran actually.

But the python bindings are great and useful to many, so Python gets to be added to the list.

Just like any language with FFI capabilities to call the same libraries.

Re: Python 3.11 vs 3.10 performance

#446

Earlier quoted context omitted.

The expressions are dynamic, so they have to be evaluated every time. Python is excessively dynamic, so it can't (conventionally) be sped up as easily as many other languages unfortunately. Finally some folks are being paid and allowed to be working on it.

I don't buy this. There are many contexts in which a smart JIT compiler can detect that an expression cannot be modified. Especially since, due to the GIL, python code is mostly non-threaded. They just didn't spend enough time to do the hard work that people spent on Javascript.

Python is harder to optimize than Javascript, as I mentioned. The subject is well explored.

It is true that they haven't tried very hard, or had the resources to until now. But Python will never be as fast as .js due to the reason above.

Re: Python 3.11 vs 3.10 performance

#447

Earlier quoted context omitted.

Why would I want to subject myself to writing in a language like bash? Bash has many disadvantages compared to Python, Nim, Go, nearly anything that isn't brainfuck.

Yeah I mean it's pretty bad, but the upside is that it will run everywhere without having to install anything and there are lots and lots of answered questions out there if you run into issues. Which I doubt is true for Nim. Using niche stuff means you're on your own in terms of support. And with how dependency happy everything is these days, I avoid trendy projects like the plague.

Nim is compiled, so a dependency on a runtime or a VM is not an issue there, at least.

Re: Python 3.11 vs 3.10 performance

#448
post #305

Earlier quoted context omitted.

Yeah breaking compatibility kills a language. He did the right thing.

yet breaking compatibility in the 2->3 transition so that we can use print in lambdas was perfectly fine.

People learn from mistakes

Re: Python 3.11 vs 3.10 performance

#449
post #14

I wish there was something like llvm for scripting languages. Imagine if python, php, javascript, dart or ruby would not interpret the code themself, but compile to an interpretable common language, where you could just plug in the fastest interpreter there is for the job.

The RPython language PyPy is written in is designed to enable writing JIT-compiled interceptors for any language: https://rpython.readthedocs.io/en/latest/ There is also the Dynamic Language Runtime, which is used to implement IronPython and IronRuby on top of .NET: https://en.wikipedia.org/wiki/Dynamic_Language_Runtime

rpython is designed to write new interpreters. Not aware of many apps written in the rpython dialect.

There are bunch of transpilers which might provide a path from statically typed python3 to native binaries. py2many is one of them.

The downside is that all of the C extensions that python3 uses become unusable and need to be rewritten in the subset of python3 that the transpiler accepts.

Re: Python 3.11 vs 3.10 performance

#450

Is there a website which tracks which of the major libraries; pandas, requests, django, etc support each major version? I remember there was one years ago for python 3.6? Been a long time!

I think this is what you’re looking for: https://pyreadiness.org/3.11/

Thanks!
Post reply on HN