Codon Looks Very Promising For Super-Fast Python Code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • chocolate
    replied
    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.
    Last edited by chocolate; 17 March 2023, 09:09 AM.

    Leave a comment:


  • schmidtbag
    replied
    Originally posted by uid313 View Post
    [*]Functions are declared using the def
    So? It's just a different word; hardly an issue.
    [*]It has the weird "walrus operator" which no other language have and is highly unfamiliar to most people.
    I myself am not a fan of unnecessary syntax; I dislike decorators for the same reason. For a language like Python, the walrus operator is counter-productive. However... it is actually kinda useful.
    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:


  • MadCatX
    replied
    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​
    Not exactly impressed...

    Leave a comment:


  • Calinou
    replied
    Originally posted by Vorpal View Post
    Never heard of that license before. Is it open source? Can't find it on https://opensource.org/licenses/... Suspicious...
    Business Source License is proprietary until 3 years have passed since a given commit. This means that old versions will eventually be open source, but not right now: https://github.com/exaloop/codon/blo...ICENSE#L33-L37

    Leave a comment:


  • archkde
    replied
    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
    The article mentions that Codon does not support all dynamic features of Python. This likely means that it omits features that disallow optimizing out these indirections.

    Leave a comment:


  • archkde
    replied
    Originally posted by Vorpal View Post
    Never heard of that license before. Is it open source? Can't find it on https://opensource.org/licenses/... Suspicious...
    No, it isn't. The MariaDB company created it for proprietary add-ons to their open-core product.

    Leave a comment:


  • sabian2008
    replied
    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.
    Will the compilation myth ever die?

    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:


  • sobkas
    replied
    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.
    If only there was person that regularly do similar benchmarks and was able to do the same in this case.
    But alas, world is not fair...

    Leave a comment:


  • uid313
    replied
    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:


  • bachchain
    replied
    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.
    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:

Working...
X