Bringing Http/Https and WebSockets High Performance servers for PyPy3 and Python3
I'm reading some arguments and counter-arguments in this thread, and in my opinion it kinda boils down to what point of view you're having.
If you look at it as a framework that minimises the networking overhead, then fine, it's an interesting piece of software.
If on the other hand you look at it like a "fast" web framework then things start to change and the discussion gets a bit more complicated.
So for example, you look at the source code of the applications being benchmarked (example: https://github.com/cirospaciari/socketify.py/blob/main/bench...) and you immediately see it's simply returning the string "hello world"). Which means that it's almost 100% of the time running in the fast path / best case.
My guess is that as soon as you start doing any kind of computation in the request handler in normal non-super-optimized python (trival example: validating some headers and/or checking some signatures as you would do with jwt tokens for example) then the python-vs-golang gap will start to go back to favour golang.
And then again, it boils down to what you're doing: anything io-intensive might benefit from the unetworking/uwebsocket beneath, anything cpu-intensive will benefit from the golang compiler producing native executable code.
Nice work anyways.
Source for the TechEmpower Framework Benchmarks project
Actually the benchmark is on https://github.com/TechEmpower/FrameworkBenchmarks with is basically this with more headers, but you are right, is not enought, i used TechEmPower because is very popular. I have some issues open to create an better JWT token support, database and much more, i will post these in the future!
The modern API for authentication & user identity. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
Python library to load dynamically typed data into statically typed data structures
I read all the perftests in the repo. I think they nearly all parse a structure that contains a repetition of the same or similar thing a couple hundred thousand times times and the timing function returns the min and max of 5 attempts. I just picked one example for posting.
Not a Python expert, but could the Pydantic tests be possibly not realistic and/or misleading because they are using kwargs in __init__  to parse the object instead of calling the parse_obj class method ? According to some PEPs , isn't Python creating a new dictionary for that parameter which would be included in the timing? That would be unfortunate if that accounted for the difference.
Something else I think about is if a performance test doesn't produce a side effect that is checked, a smart compiler or runtime could optimize the whole benchmark away. Or too easy for the CPU to do branch prediction, etc. I think I recall that happening to me in Java in the past, but probably not happened here in Python.
A high-performance, zero-overhead, extensible Python compiler using LLVM
Good point! However, you bring in a common misconception I'm fighting with within my company for a long time. Python is not an interpreted language. There is no such thing as an "interpreted language", a language is just a set or rules and keywords. Everything you can fit into Backus–Naur form is already a language even if it doesn't have any implementation nor compiler neither interpreter.
Core validation logic for pydantic written in rust
pydandic-core  will hopefully solve this issue (written in Rust)
The Web framework for perfectionists with deadlines.
Meinheld is a high performance asynchronous WSGI Web Server (based on picoev)
Learn 300+ open source libraries for free using AI. LearnThisRepo lets you learn 300+ open source repos including Postgres, Langchain, VS Code, and more by chatting with them using AI!
🚀 gnet is a high-performance, lightweight, non-blocking, event-driven networking framework written in pure Go./ gnet 是一个高性能、轻量级、非阻塞的事件驱动 Go 网络框架。
Since we're in the useless benchmark, this Go native library completely wreck any C/C++ lib wrapped by Python: https://github.com/panjf2000/gnet
High performance Golang IPv4 and IPv6 capable TCP server with TLS support, graceful shutdown and TCP FastOpen
Python Enhancement Proposals
Oh, I have a pretty fresh news for you.
Pystack: Like Pstack but for Python
3 projects | news.ycombinator.com | 7 Jun 2023
Show HN: Gsubpy, an interpreter for subset of Python, written in Go
3 projects | news.ycombinator.com | 21 Apr 2023
Why you can’t switch to Python 3.10 just yet
1 project | /r/Python | 5 Oct 2021
Exposing C API to Go
1 project | /r/golang | 21 Mar 2021
Spiral – High-Performance PHP Framework
1 project | news.ycombinator.com | 23 Feb 2024