Stop being the product.
Become the owner.
or
sign uplog in

Edge Python Update: Mark-sweep Garbage Collector +…

Edge Python Update: Mark-sweep Garbage Collector + explicit VmErr + overflow and dicts fixes

Some days ago I posted the first update about Edge Python here and it received 351 upvotes and 83 comments. Thank you for all the great feedback :).

Heres the current state of the Python 3.13 compiler written in Rust:

**Major progress since the last post**

* Full **stop-the-world mark-sweep garbage collector** (inspired by Ierusalimschy) with string interning (less or equal 64 bytes), free-list reuse, and allocation-count triggering.
* All unimplemented opcodes now return proper **VmErr** errors instead of silent no-ops.
* Major correctness fixes:
* Integer overflow handling (`add`/`sub`/`mul`/`abs`/unary minus) now uses `i128` \+ automatic promotion to float via `Val::int_checked`.
* Stable equality for dict keys (string interning + recursive `eq_vals` for `List`/`Tuple`/`Set`/`Dict`).
* Empty tuple literals, default parameters, slicing, generalized `zip`, O(n) deduplication with `HashSet`, and several WASM/heap fixes.

**Note about the fib(45) benchmark**

Several people correctly pointed out that template memoization (enabled by the SSA form) turns the recursive Fibonacci into O(n) after warm-up. This is intentional behavior of the adaptive VM, but I understand it can feel unfair for direct comparison. The non-recursive 1-million-iteration benchmark remains very close to CPython.

**Benchmarks**

def fib(n):
if n < 2: return n
return fib(n-1) + fib(n-2)
print(fib(45))

|Runtime|fib(45) real|
|:-|:-|
|CPython 3.13|1m 56s|
|**Edge Python**|**0.011 s**|

(1 000 000 iterations benchmark is still \~0.056 s vs CPython \~0.058 s)

counter: int = 0
for _ in range(1_000_000):
counter += 1
print(counter)

| Runtime | real | user | sys |
|--------------|----------|----------|----------|
| CPython 3.13 | 0m0.058s | 0m0.041s | 0m0.008s |
| Edge Python | 0m0.056s | 0m0.054s | 0m0.001s |

**Organizing the Project**

Currently, taking into account the feedback I received from the various communities where I posted the project, I decided to analyze it and open tickets for everything. Here's my question for you: how do you organize yourselves?

I implemented a simple board in Notion, however, I'm looking for recommendations since I want to be able to concentrate as much as possible...

**Repository:** https://github.com/dylan-sutton-chavez/edge-python https://github.com/dylan-sutton-chavez/edge-python/tree/main/compiler

Thanks again for the feedback last time... it really helped shape the project! Feel free to ask anything about SSA, inline caching, memoization, or the roadmap.
#programming #dev #technology
source
earnings
3,000 mlx total
$0  total
engagement
4 views
0 reactions

0 comments