typedload
codon
Our great sponsors
typedload | codon | |
---|---|---|
5 | 34 | |
252 | 13,760 | |
- | 0.9% | |
8.0 | 7.9 | |
4 days ago | 7 days ago | |
Python | C++ | |
GNU General Public License v3.0 or later | GNU General Public License v3.0 or later |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
typedload
-
Show HN: Up to 100x Faster FastAPI with simdjson and io_uring on Linux 5.19
Author of typedload here!
FastAPI relies on (not so fast) pydantic, which is one of the slowest libraries in that category.
Don't expect to find such benchmarks on the pydantic documentation itself, but the competing libraries will have them.
-
Pydantic vs Protobuf vs Namedtuples vs Dataclasses
I wrote typedload, which is significantly faster than pydantic. Just uses normal dataclasses/attrs/NamedTuple, has a better API and is pure Python!
-
Show HN: Python framework is faster than Golang Fiber
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
The perf part of the tests just seems to be a microbenchmark for seeing how fast the various frameworks can parse a 30000x300 dict of strings representing numbers [1].
If that is all one's application does, and can use your library in their organization/team, that's great. However a 2-3x performance boost for the parsing stage for a use case like an API call might not matter when that could be overshadowed by validation and/or upstream API calls. A realistic app would likely use a validation library like Pydantic's [2] to throw a custom typed-error that can be processed, e.g., localization, before returning it downstream.
[1] https://github.com/ltworf/typedload/blob/37c72837e0a8fd5f350...
codon
- Should I Open Source my Company?
-
Python running on the Dart VM?
I found at least one project that managed to compile python AOT to LLVM https://github.com/exaloop/codon. Even if LLVM is more expressive than Dart Kernel, that should at least be some evidence that this might not be too impractical.
-
Codon: Python Compiler
Repo for more details: https://github.com/exaloop/codon
> What is Codon?
> Codon is a high-performance Python compiler that compiles Python code to native machine code without any runtime overhead. Typical speedups over Python are on the order of 10-100x or more, on a single thread. Codon's performance is typically on par with (and sometimes better than) that of C/C++. Unlike Python, Codon supports native multithreading, which can lead to speedups many times higher still. Codon grew out of the Seq project.
> What isn't Codon?
> While Codon supports nearly all of Python's syntax, it is not a drop-in replacement, and large codebases might require modifications to be run through the Codon compiler. For example, some of Python's modules are not yet implemented within Codon, and a few of Python's dynamic features are disallowed. The Codon compiler produces detailed error messages to help identify and resolve any incompatibilities.
> Codon can be used within larger Python codebases via the @codon.jit decorator. Plain Python functions and libraries can also be called from within Codon via Python interoperability.
Their fannkuch benchmark seems to be a bit dishonest. They claim an enormous perf delta on https://exaloop.io/benchmarks.html but fannkuch uses factorial a lot and they define factorial with a very small (n=20) table: https://github.com/exaloop/codon/blob/fb461371613049539654c1...
Disclaimer: I've worked on several Python runtimes and compilers, but I'm not by any means out to get Codon. Just happened across this by accident while looking at their inline LLVM, which is neat.
-
Mojo – a new programming language for all AI developers
Another "Python with high-performance compiled builds" would be https://github.com/exaloop/codon.
-
Is there a way to use turn a project into a single executable file that doesn't require anyone to do anything like install Python before using it?
Try Codon? https://github.com/exaloop/codon
- Since when did Python haters spread out everywhere? Maybe DNF5 would be faster because of ditched it, maybe.
- What are your thoughts on Codon compiler having a paid licence?
-
Python-based compiler achieves orders-of-magnitude speedups
nit: 'Python-based' would imply to me that it's written in Python, but it looks like it's mostly C++ & LLVM:
- Show HN: Codon: A Compiler for High-Performance Pythonic Applications and DSLs [pdf]
What are some alternatives?
Nuitka - Nuitka is a Python compiler written in Python. It's fully compatible with Python 2.6, 2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, and 3.11. You feed it your Python app, it does a lot of clever things, and spits out an executable or extension module.
Numba - NumPy aware dynamic Python compiler using LLVM
Cython - The most widely used Python to C compiler
taichi - Productive, portable, and performant GPU programming in Python.
julia - The Julia Programming Language
Nim - Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
Django - The Web framework for perfectionists with deadlines.
pure_numba_alias_sampling - Pure numba version of Alias sampling algorithm from L. Devroye's, "Non-Uniform Random Random Variate Generation"
Coconut - Simple, elegant, Pythonic functional programming.
FrameworkBenchmarks - Source for the TechEmpower Framework Benchmarks project
mypyc - Compile type annotated Python to fast C extensions
ustore - Multi-Modal Database replacing MongoDB, Neo4J, and Elastic with 1 faster ACID solution, with NetworkX and Pandas interfaces, and bindings for C 99, C++ 17, Python 3, Java, GoLang 🗄️