[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-2708":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":25,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":34,"readmeContent":35,"aiSummary":36,"trendingCount":16,"starSnapshotCount":16,"syncStatus":37,"lastSyncTime":38,"discoverSource":39},2708,"codon","exaloop\u002Fcodon","exaloop","A high-performance, zero-overhead, extensible Python compiler with built-in NumPy support","https:\u002F\u002Fdocs.exaloop.io",null,"Python",16794,602,136,94,0,1,14,35,7,80.84,"Apache License 2.0",false,"develop",true,[27,28,29,30,31,32,33],"compiler","gpu-programming","high-performance","llvm","numpy","parallel-programming","python","2026-06-12 04:00:15","\u003Ch1 align=\"center\">\n \u003Cimg src=\"docs\u002Fimg\u002Fcodon-banner.svg\" alt=\"Codon banner\"\u002F>\n\u003C\u002Fh1>\n\n\u003Ch3 align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fdocs.exaloop.io\u002Fcodon\" target=\"_blank\">\u003Cb>Docs\u003C\u002Fb>\u003C\u002Fa>\n  &nbsp;&#183;&nbsp;\n  \u003Ca href=\"https:\u002F\u002Fdocs.exaloop.io\u002Fcodon\u002Fgeneral\u002Ffaq\" target=\"_blank\">\u003Cb>FAQ\u003C\u002Fb>\u003C\u002Fa>\n  &nbsp;&#183;&nbsp;\n  \u003Ca href=\"https:\u002F\u002Fexaloop.io\u002Fblog\" target=\"_blank\">\u003Cb>Blog\u003C\u002Fb>\u003C\u002Fa>\n  &nbsp;&#183;&nbsp;\n  \u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002FHeWRhagCmP\" target=\"_blank\">Discord\u003C\u002Fa>\n  &nbsp;&#183;&nbsp;\n  \u003Ca href=\"https:\u002F\u002Fdocs.exaloop.io\u002Fcodon\u002Fgeneral\u002Froadmap\" target=\"_blank\">Roadmap\u003C\u002Fa>\n  &nbsp;&#183;&nbsp;\n  \u003Ca href=\"https:\u002F\u002Fexaloop.io\u002F#benchmarks\" target=\"_blank\">Benchmarks\u003C\u002Fa>\n\u003C\u002Fh3>\n\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fexaloop\u002Fcodon\u002Factions\u002Fworkflows\u002Fci.yml\">\n  \u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fexaloop\u002Fcodon\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg\"\n       alt=\"Build Status\">\n\u003C\u002Fa>\n\n# What is Codon?\n\nCodon is a high-performance Python implementation that compiles to native machine code without\nany runtime overhead. Typical speedups over vanilla Python are on the order of 10-100x or more, on\na single thread. Codon's performance is typically on par with (and sometimes better than) that of\nC\u002FC++. Unlike Python, Codon supports native multithreading, which can lead to speedups many times\nhigher still.\n\n*Think of Codon as Python reimagined for static, ahead-of-time compilation, built from the ground\nup with best possible performance in mind.*\n\n## Goals\n\n- :bulb: **No learning curve:** Be as close to CPython as possible in terms of syntax, semantics and libraries\n- :rocket: **Top-notch performance:** At *least* on par with low-level languages like C, C++ or Rust\n- :computer: **Hardware support:** Full, seamless support for multicore programming, multithreading (no GIL!), GPU and more\n- :chart_with_upwards_trend: **Optimizations:** Comprehensive optimization framework that can target high-level Python constructs\n  and libraries\n- :battery: **Interoperability:** Full interoperability with Python's ecosystem of packages and libraries\n\n## Non-goals\n\n- :x: *Drop-in replacement for CPython:* Codon is not a drop-in replacement for CPython. There are some\n  aspects of Python that are not suitable for static compilation — we don't support these in Codon.\n  There are ways to use Codon in larger Python codebases via its [JIT decorator](https:\u002F\u002Fdocs.exaloop.io\u002Fcodon\u002Finteroperability\u002Fdecorator)\n  or [Python extension backend](https:\u002F\u002Fdocs.exaloop.io\u002Fcodon\u002Finteroperability\u002Fpyext). Codon also supports\n  calling any Python module via its [Python interoperability](https:\u002F\u002Fdocs.exaloop.io\u002Fcodon\u002Finteroperability\u002Fpython).\n  See also [*\"Differences with Python\"*](https:\u002F\u002Fdocs.exaloop.io\u002Fcodon\u002Fgeneral\u002Fdifferences) in the docs.\n\n- :x: *New syntax and language constructs:* We try to avoid adding new syntax, keywords or other language\n  features as much as possible. While Codon does add some new syntax in a couple places (e.g. to express\n  parallelism), we try to make it as familiar and intuitive as possible.\n\n## How it works\n\n\u003Cp align=\"center\">\n \u003Cimg src=\"docs\u002Fimg\u002Fcodon-pipeline.svg\" width=\"90%\" alt=\"Codon figure\"\u002F>\n\u003C\u002Fp>\n\n# Quick start\n\nDownload and install Codon with this command:\n\n```bash\n\u002Fbin\u002Fbash -c \"$(curl -fsSL https:\u002F\u002Fexaloop.io\u002Finstall.sh)\"\n```\n\nAfter following the prompts, the `codon` command will be available to use. For example:\n\n- To run a program: `codon run file.py`\n- To run a program with optimizations enabled: `codon run -release file.py`\n- To compile to an executable: `codon build -release file.py`\n- To generate LLVM IR: `codon build -release -llvm file.py`\n\nMany more options are available and described in [the docs](https:\u002F\u002Fdocs.exaloop.io\u002Fcodon\u002Fgeneral\u002Fintro).\n\nAlternatively, you can [build from source](https:\u002F\u002Fdocs.exaloop.io\u002Fcodon\u002Fadvanced\u002Fbuild).\n\n# Examples\n\n## Basics\n\nCodon supports much of Python, and many Python programs will work with few if any modifications.\nHere's a simple script `fib.py` that computes the 40th Fibonacci number...\n\n``` python\nfrom time import time\n\ndef fib(n):\n    return n if n \u003C 2 else fib(n - 1) + fib(n - 2)\n\nt0 = time()\nans = fib(40)\nt1 = time()\nprint(f'Computed fib(40) = {ans} in {t1 - t0} seconds.')\n```\n\n... run through Python and Codon:\n\n```\n$ python3 fib.py\nComputed fib(40) = 102334155 in 17.979357957839966 seconds.\n$ codon run -release fib.py\nComputed fib(40) = 102334155 in 0.275645 seconds.\n```\n\n## Using Python libraries\n\nYou can import and use any Python package from Codon via `from python import`. For example:\n\n```python\nfrom python import matplotlib.pyplot as plt\ndata = [x**2 for x in range(10)]\nplt.plot(data)\nplt.show()\n```\n\n(Just remember to set the `CODON_PYTHON` environment variable to the CPython shared library,\nas explained in the [the Python interoperability docs](https:\u002F\u002Fdocs.exaloop.io\u002Fcodon\u002Finteroperability\u002Fpython).)\n\n## Parallelism\n\nCodon supports native multithreading via [OpenMP](https:\u002F\u002Fwww.openmp.org\u002F). The `@par` annotation\nin the code below tells the compiler to parallelize the following `for`-loop, in this case using\na dynamic schedule, chunk size of 100, and 16 threads.\n\n```python\nfrom sys import argv\n\ndef is_prime(n):\n    factors = 0\n    for i in range(2, n):\n        if n % i == 0:\n            factors += 1\n    return factors == 0\n\nlimit = int(argv[1])\ntotal = 0\n\n@par(schedule='dynamic', chunk_size=100, num_threads=16)\nfor i in range(2, limit):\n    if is_prime(i):\n        total += 1\n\nprint(total)\n```\n\nNote that Codon automatically turns the `total += 1` statement in the loop body into an atomic\nreduction to avoid race conditions. Learn more in the [multithreading docs](https:\u002F\u002Fdocs.exaloop.io\u002Fcodon\u002Fadvanced\u002Fparallel).\n\nCodon also supports writing and executing GPU kernels. Here's an example that computes the\n[Mandelbrot set](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FMandelbrot_set):\n\n```python\nimport gpu\n\nMAX    = 1000  # maximum Mandelbrot iterations\nN      = 4096  # width and height of image\npixels = [0 for _ in range(N * N)]\n\ndef scale(x, a, b):\n    return a + (x\u002FN)*(b - a)\n\n@gpu.kernel\ndef mandelbrot(pixels):\n    idx = (gpu.block.x * gpu.block.dim.x) + gpu.thread.x\n    i, j = divmod(idx, N)\n    c = complex(scale(j, -2.00, 0.47), scale(i, -1.12, 1.12))\n    z = 0j\n    iteration = 0\n\n    while abs(z) \u003C= 2 and iteration \u003C MAX:\n        z = z**2 + c\n        iteration += 1\n\n    pixels[idx] = int(255 * iteration\u002FMAX)\n\nmandelbrot(pixels, grid=(N*N)\u002F\u002F1024, block=1024)\n```\n\nGPU programming can also be done using the `@par` syntax with `@par(gpu=True)`. See the\n[GPU programming docs](https:\u002F\u002Fdocs.exaloop.io\u002Fcodon\u002Fadvanced\u002Fgpu) for more details.\n\n## NumPy support\n\nCodon includes a feature-complete, fully-compiled native NumPy implementation. It uses the same\nAPI as NumPy, but re-implements everything in Codon itself, allowing for a range of optimizations\nand performance improvements.\n\nHere's an example NumPy program that approximates $\\pi$ using random numbers...\n\n``` python\nimport time\nimport numpy as np\n\nrng = np.random.default_rng(seed=0)\nx = rng.random(500_000_000)\ny = rng.random(500_000_000)\n\nt0 = time.time()\n# pi ~= 4 x (fraction of points in circle)\npi = ((x-1)**2 + (y-1)**2 \u003C 1).sum() * (4 \u002F len(x))\nt1 = time.time()\n\nprint(f'Computed pi~={pi:.4f} in {t1 - t0:.2f} sec')\n```\n\n... run through Python and Codon:\n\n```\n$ python3 pi.py\nComputed pi~=3.1417 in 2.25 sec\n$ codon run -release pi.py\nComputed pi~=3.1417 in 0.43 sec\n```\n\nCodon can speed up NumPy code through general-purpose and NumPy-specific compiler optimizations,\nincluding inlining, fusion, memory allocation elision and more. Furthermore, Codon's NumPy\nimplementation works with its multithreading and GPU capabilities, and can even integrate with\n[PyTorch](https:\u002F\u002Fpytorch.org). Learn more in the [Codon-NumPy docs](https:\u002F\u002Fdocs.exaloop.io\u002Fcodon\u002Finteroperability\u002Fnumpy).\n\n# Documentation\n\nPlease see [docs.exaloop.io](https:\u002F\u002Fdocs.exaloop.io) for in-depth documentation.\n\n# Acknowledgements\n\nThis project would not be possible without:\n\n- **Funding**:\n  - National Science Foundation (NSF) 🇺🇸\n  - National Institutes of Health (NIH) 🇺🇸\n  - MIT 🇺🇸\n  - MIT E14 Fund 🇺🇸\n  - Natural Sciences and Engineering Research Council (NSERC) 🇨🇦\n  - Canada Research Chairs 🇨🇦\n  - Canada Foundation for Innovation 🇨🇦\n  - B.C. Knowledge Development Fund 🇨🇦\n  - University of Victoria 🇨🇦\n- **Libraries**:\n  [LLVM Compiler Infrastructure](https:\u002F\u002Fllvm.org\u002F),\n  [yhirose's peglib](https:\u002F\u002Fgithub.com\u002Fyhirose\u002Fcpp-peglib),\n  [Boehm-Demers-Weiser Garbage Collector](https:\u002F\u002Fgithub.com\u002Fivmai\u002Fbdwgc),\n  [KonanM's tser](https:\u002F\u002Fgithub.com\u002FKonanM\u002Ftser),\n  [{fmt}](https:\u002F\u002Fgithub.com\u002Ffmtlib\u002Ffmt),\n  [toml++](https:\u002F\u002Fmarzer.github.io\u002Ftomlplusplus\u002F),\n  [semver](https:\u002F\u002Fgithub.com\u002FNeargye\u002Fsemver),\n  [zlib-ng](https:\u002F\u002Fgithub.com\u002Fzlib-ng\u002Fzlib-ng),\n  [xz](https:\u002F\u002Fgithub.com\u002Ftukaani-project\u002Fxz),\n  [bz2](https:\u002F\u002Fsourceware.org\u002Fbzip2\u002F),\n  [Google RE2](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fre2),\n  [libbacktrace](https:\u002F\u002Fgithub.com\u002Fianlancetaylor\u002Flibbacktrace),\n  [fast_float](https:\u002F\u002Fgithub.com\u002Ffastfloat\u002Ffast_float),\n  [Google Highway](https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fhighway),\n  [NumPy](https:\u002F\u002Fnumpy.org\u002F)\n","Codon 是一个高性能的 Python 编译器，能够将 Python 代码编译为无运行时开销的本地机器码。它支持内置的 NumPy 库，并且在单线程上相较于原生 Python 可以实现 10 到 100 倍以上的加速，性能甚至可以与 C\u002FC++ 相媲美。Codon 支持原生多线程编程，没有全局解释器锁（GIL）的限制，还提供了对 GPU 的无缝支持，适用于需要高性能计算的场景，如科学计算、数据分析和大规模并行处理等。此外，Codon 保持了与 Python 生态系统的互操作性，用户可以继续使用现有的 Python 库和工具。",2,"2026-06-11 02:50:59","top_language"]