Cython but with PEP 484 type hints, therefore closer-to-real-Python syntax?
Cython's main advantage is that it lets you selectively optimize routines that don't need to call into CPython's (or PyPy's) dynamic stuff, while also going back into the interpreter for code that either can't be statically compiled or isn't performance-sensitive do begin with. Can Codon do that?
Edit: also, Cython is already Apache License 2.0 and you don't have to wait until 2025 for it. Not a fan of Codon's licensing... can it still be competitive and seriously taken under consideration during its non-OSI state? Oh well, neat project nonetheless.
Codon Looks Very Promising For Super-Fast Python Code
Collapse
X
-
Originally posted by uid313 View Post[*]Functions are declared using the def
[*]It has the weird "walrus operator" which no other language have and is highly unfamiliar to most people.
I pretty much agree with the rest, but in a few of those cases, it's like using a pipewrench to hammer a nail. Yeah, it'll work, but it's not the right tool for the job.Last edited by schmidtbag; 17 March 2023, 09:12 AM.
Leave a comment:
-
-
I wanted to check out how a reference implementation of a thing in Python would stack up against my reimplementation of that thing in C++ when I run it through Codon
Code:naval:2:8-16: error: no module named 'argparse' naval:5:6-20: error: no module named 'naval.validate' naval:11:22-45: error: cannot import name 'path' from 'os.__init__' naval:12:13-24: error: no module named 'ext' naval:23:14-109: error: no module named 'argparse' naval:25:5-137: error: no module named 'parser' naval:26:5-172: error: no module named 'parser' naval:27:5-176: error: no module named 'parser' naval:28:5-181: error: no module named 'parser' naval:30:12-31: error: no module named 'parser' naval:31:5-9: error: name 'main' is not defined​
Leave a comment:
-
-
Originally posted by Vorpal View PostNever heard of that license before. Is it open source? Can't find it on https://opensource.org/licenses/... Suspicious...
Leave a comment:
-
-
Originally posted by bachchain View Post
The best compiler in the world can't make up for how Python completely destroys caches and prefetchers by indirecting literally everything
Leave a comment:
-
-
Originally posted by Vorpal View PostNever heard of that license before. Is it open source? Can't find it on https://opensource.org/licenses/... Suspicious...
Leave a comment:
-
-
Originally posted by slalomsk8er View Post
Wrong. If you compile it to native machine code it can be as fast as every other language.
Codon is a Python compiler.
Python IS compiled. Look in your execution folder for .pyc files (usually under __pycache__). Those are python bytecode files, the result of a IR compilation of previous runs.
Compare the execution of .pyc files with a similar algorithm running through the JVM of Java. The difference can be easily one or two orders of magnitude.
The real difference between AOT compilation and JIT compilation is usually O(1), as numerous languages implementation have proven. Python is slow because even adding two ints requires a fairly complex call stack.
Lots of optimizarions can be done to CPython because performance was never a priority goal. However, at the end of the day, there is not enough information to map scripts to efficient Assembly instructions.Last edited by sabian2008; 17 March 2023, 08:03 AM.
Leave a comment:
-
-
It should be interesting for benchmarking Codon against Python 3.11 considering its recent upstream performance optimizations as well as seeing how it stacks up against some of the other performance-optimized Python implementations.
But alas, world is not fair...
Leave a comment:
-
-
Python 3.11 already got much faster, and Python 3.12 is likely to further bring some performance improvements.
Python has its strengths and maybe it doesn't need to be so fast, it is still valuable for other reasons.
Python also has its weaknesses:- Functions are declared using the def keyword instead of fn, fun, func or function.
- There is no static keyword, so static class variables have an implicit semantics that isn't obvious and can be rather confusing.
- It has the weird "walrus operator" which no other language have and is highly unfamiliar to most people.
- It has its own vanity license.
- It is difficult to embed into another application.
- If executing Python code from within a Python application that code will have complete access to all of the application.
- It is not possible to limit things such as file system access, network access, etc.
Leave a comment:
-
Originally posted by slalomsk8er View Post
Wrong. If you compile it to native machine code it can be as fast as every other language.
Codon is a Python compiler.
Leave a comment:
-
Leave a comment: