Live data from Hacker News

Faster Python with Guido van Rossum

softwareatscale.dev

51–60 of 251 posts

Re: Faster Python with Guido van Rossum

#51
I'd be happy with just an optimized strict subset of python that uses type annotations to compile performance critical functions like cython. Mypyc sounds like an attempt at that but doesn't seem to be constraining the language enough to allow it to shed the dynamic nature of the language. Another similar effort was EPython, but it doesn't look like anyone is working on it.

I guess Numba would be the closest thing to this at the moment.

Re: Faster Python with Guido van Rossum

#52

how about getting rid of GIL?

If you get rid of the GIL you have to replace one big lock with a bunch of very small locks, which actually hurts performance for programs which only need 1 core, which is most programs.

> If you get rid of the GIL you have to replace one big lock with a bunch of very small locks, which actually hurts performance for programs which only need 1 core, which is most programs.

Python could do what most other languages do and allow programmers to explicitly add locks to the code that needs to be locked, rather than locking everything, all the time.

Re: Faster Python with Guido van Rossum

#53
post #44
post #32

Earlier quoted context omitted.

As a sibling mentions, the multiprocessing support is basically support for spawning new processes. It's better than nothing, but it's not very good for the performance. The real problem with Python multicore is that the main problem is solves is the one ctur is talking about, namely, "Oh crap, I used Python and it doesn't run fast enough for my needs... maybe I can run more processes?" Using a language that is alrea…

> Python is now only incrementally better than modern static languages in some dimensions The main benefit of Python now over those newer languages is its ecosystem.

Really I think this is only true for the data science ecosystem. In most other cases, modern static language ecosystems are at least as advanced as Python.

Re: Faster Python with Guido van Rossum

#55
post #14
post #4

I have become increasingly convinced Python as a language is a "trap" for any use of notable scale, be the scale about number of developers, codebase size, or performance requirements. It's a great 0->1 language and great at simple glue, but eventually you hit a wall and have to keep investing larger and larger amounts of people or computing resources to get continued returns... all due to fundamental design decision…

Do you have the opposite experience? A language used by FAANG that doesn’t have performance issues at their scale. They seem to invest a lot in JavaScript which is not what I’d call a performant language and as you’ve said Python. I’ve used Python for more scripting type tasks and creating basic APIs to get specific jobs done. I’m very weary to go “all in” on Python for an app based on all the feedback about performa…

> They seem to invest a lot in JavaScript which is not what I’d call a performant language

JavaScript (V8 at least) is extremely performant, near native code performance. Considering how dynamic it is, it's not an easy feat but Google, Apple and Mozilla work a lot on it.

Here's a benchmark where JS is 50x faster than Python: https://github.com/kostya/benchmarks

Note that PyPy does much better.

Re: Faster Python with Guido van Rossum

#56
post #4

I have become increasingly convinced Python as a language is a "trap" for any use of notable scale, be the scale about number of developers, codebase size, or performance requirements. It's a great 0->1 language and great at simple glue, but eventually you hit a wall and have to keep investing larger and larger amounts of people or computing resources to get continued returns... all due to fundamental design decision…

Likewise. I cut my teeth on Python 20 years ago and I loved it back then - even getting my hands dirty in the guts of the interpreter.

But now in hindsight, I'm shocked that Python 3.0 wasn't seized as an opportunity to lose more of its baggage - the under-optimized interpreter, the poor parallelization story, the excessive surface area of the interpreter exposed to Python itself, making it impractical to re-implement in other interpreters, better typing, etc.

They broke backwards compatibility and all we got for it was Unicode?

Re: Faster Python with Guido van Rossum

#57
post #4

I have become increasingly convinced Python as a language is a "trap" for any use of notable scale, be the scale about number of developers, codebase size, or performance requirements. It's a great 0->1 language and great at simple glue, but eventually you hit a wall and have to keep investing larger and larger amounts of people or computing resources to get continued returns... all due to fundamental design decision…

> This means performance will fall further and further behind compiled languages. This is exactly as it should be: the nature of the interpreter is that it has to do a lot of the work a compiler does when it compiles whenever a new command is run (and in Python's case, that is before you cover the whole "everything is an object" part). Yes, some of it can be mitigated, but the expectation that an interpreter keep pac…

> hat I'd love is a language that can be compiled (and be highly optimized) and interpreted without changing it's behavior.

This has been a great feature of many lisps for 4+ decades now. Not unique to them of course.

Re: Faster Python with Guido van Rossum

#58
post #4

I have become increasingly convinced Python as a language is a "trap" for any use of notable scale, be the scale about number of developers, codebase size, or performance requirements. It's a great 0->1 language and great at simple glue, but eventually you hit a wall and have to keep investing larger and larger amounts of people or computing resources to get continued returns... all due to fundamental design decision…

Also, typing in python has a "kluge" feel about it. It's like most things in python: it works nicely on toy examples, but is rather frail on the edges (if you're not convinced try to define the json type). I also think they chose the wrong strategy (type inference would have been way better) To use a metaphor: Python is the duplo of programming languages.

Python has always had strong, inferred typing. It’s just that you can rebind variables.

Re: Faster Python with Guido van Rossum

#59
post #44
post #32

Earlier quoted context omitted.

As a sibling mentions, the multiprocessing support is basically support for spawning new processes. It's better than nothing, but it's not very good for the performance. The real problem with Python multicore is that the main problem is solves is the one ctur is talking about, namely, "Oh crap, I used Python and it doesn't run fast enough for my needs... maybe I can run more processes?" Using a language that is alrea…

> Python is now only incrementally better than modern static languages in some dimensions The main benefit of Python now over those newer languages is its ecosystem.

Is Java not a "modern static language"?

Re: Faster Python with Guido van Rossum

#60

how about getting rid of GIL?

If you get rid of the GIL you have to replace one big lock with a bunch of very small locks, which actually hurts performance for programs which only need 1 core, which is most programs.

Ok, can we do this? Python interpreter can understand if it is running on 1 core processor (assume 1 core = 1 HW thread) or multi core processor. Then use GIL taht suits. ie, if the code uses multiple SW threads, use GIL that suits needs... something like possible? Any reason why experts are not doing this? -p
Post reply on HN