thautwarm / diojit

Fully compatible CPython jit compiler. Optimising Dynamic, Interpreted, and Object-oriented(DIO) programs.
BSD 2-Clause "Simplified" License
117 stars 2 forks source link

assuming const global references for @jit decorated classes and functions #18

Open thautwarm opened 3 years ago

thautwarm commented 3 years ago
F = ...

@jit
def f(x):
   return F(x)

In order to get extreme performance gain, flags can be set to break CPython semantics so that F always referenced to the object we've seen, instead of allowing later mutations.

thautwarm commented 3 years ago

It is observed that in usual cases, global references wouldn't change at all. If you want to use a mutable global variable in @jit functions, maybe writing globals()[name] is better?