Show HN: Python framework is faster than Golang Fiber

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
Nutrient - The #1 PDF SDK Library
Bad PDFs = bad UX. Slow load times, broken annotations, clunky UX frustrates users. Nutrient’s PDF SDKs gives seamless document experiences, fast rendering, annotations, real-time collaboration, 100+ features. Used by 10K+ devs, serving ~half a billion users worldwide. Explore the SDK for free.
nutrient.io
featured
  1. socketify.py

    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.

  2. CodeRabbit

    CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.

    CodeRabbit logo
  3. FrameworkBenchmarks

    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!

  4. typedload

    Discontinued 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__ [1] to parse the object instead of calling the parse_obj class method [2]? According to some PEPs [3], 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.

    [1] https://github.com/ltworf/typedload/blob/37c72837e0a8fd5f350...

    [2] https://docs.pydantic.dev/usage/models/#helper-functions

    [3] https://peps.python.org/pep-0692/

  5. codon

    A high-performance, zero-overhead, extensible Python compiler with built-in NumPy support

    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.

    Just as a piece of evidence, there are interpreted C++ (http://www.artificialworlds.net/wiki/IGCC/IGCC) and AOT Python (https://github.com/exaloop/codon) implementations.

  6. pydantic-core

    Core validation logic for pydantic written in rust

    pydandic-core [0] will hopefully solve this issue (written in Rust)

    [0] -- https://github.com/pydantic/pydantic-core

  7. Django

    The Web framework for perfectionists with deadlines.

    Django is an WebFramework, Meinheld is an WSGI Server framework.

    https://github.com/django/django

    https://github.com/mopemope/meinheld

    So django meinheld is basically saying that i used Django served by meinheld in that benchmark.

  8. meinheld

    Meinheld is a high performance asynchronous WSGI Web Server (based on picoev)

    Django is an WebFramework, Meinheld is an WSGI Server framework.

    https://github.com/django/django

    https://github.com/mopemope/meinheld

    So django meinheld is basically saying that i used Django served by meinheld in that benchmark.

  9. Nutrient

    Nutrient - The #1 PDF SDK Library. Bad PDFs = bad UX. Slow load times, broken annotations, clunky UX frustrates users. Nutrient’s PDF SDKs gives seamless document experiences, fast rendering, annotations, real-time collaboration, 100+ features. Used by 10K+ devs, serving ~half a billion users worldwide. Explore the SDK for free.

    Nutrient logo
  10. gnet

    🚀 gnet is a high-performance, lightweight, non-blocking, event-driven networking framework written in pure 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

  11. tcpserver

    High performance Golang IPv4 and IPv6 capable TCP server with TLS support, graceful shutdown and TCP FastOpen

  12. peps

    Python Enhancement Proposals

    Oh, I have a pretty fresh news for you.

    https://github.com/python/peps/pull/2955

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Goravel: PHP's Laravel like web framework supercharged with Go

    2 projects | news.ycombinator.com | 10 Sep 2024
  • Show HN: Fastest regex library for Python. Wrapper of regex (Rust)

    1 project | news.ycombinator.com | 4 Jul 2024
  • Improve Your Python Regex Performance Using Rust

    1 project | dev.to | 29 Jun 2024
  • How to use Templ with Goravel

    3 projects | dev.to | 4 May 2024
  • Pystack: Like Pstack but for Python

    3 projects | news.ycombinator.com | 7 Jun 2023

Did you know that Python is
the 2nd most popular programming language
based on number of references?