[ prog / sol / mona ]

prog


Copy and patch

1 2024-01-11 03:32

New JIT strategy has appeared. Write functions to evaluate opcodes (or common expressions), build them with an optimizing compiler, and then stitch them together with memcpy. Not radically different from how Forth works, but made faster by some cheap optimizations and clever API design. An implementation of this just landed in Python the other day.

2 2024-01-11 17:44

Very interesting.
https://tonybaloney.github.io/posts/python-gets-a-jit.html

3 2024-01-11 18:19

>>2

The JIT that is proposed for Python 3.13 is a copy-and-patch JIT.

4 2024-01-18 00:49

sweet

5 2024-01-26 17:50

Why a copy-and-patch JIT?

6 2024-02-13 08:34

>>5
probably because it's simple.

7 2024-02-13 22:53

>>5,6
It compiles very fast (relative to "real" optimizers like LLVM) and the output runs very fast (relative to shit like register-based bytecode VMs). It is very difficult to improve either one of those qualities without totally sacrificing the other. Historically, you had to just pick one. Having both is very nice.

8


VIP:

do not edit these