tonybaloney / Pyjion

Pyjion - A JIT for Python based upon CoreCLR
https://www.trypyjion.com
MIT License
1.42k stars 59 forks source link

Is there a switch to turn on pyjion? #489

Open zhuofeng6 opened 2 years ago

zhuofeng6 commented 2 years ago

hi, my dear friend, forgive me for bothering you again

we all know, if i want to compile with pyjion in python, i can do it

pyjion test.py python3.10 -m pyjion test.py

But if i want to compile with python3.10 test.py, and test.py must import pyjion, for example,

#test.py
import pyjion
pyjion.enable()
print("hello pyjion") # for example this

Now i want to know, if i don't import pyjion in the file, but i want to compile with python3.10 test.py, Is there a switch to turn on pyjion?

imkow commented 2 years ago

why do you want that?

zhuofeng6 commented 2 years ago

I hava a project written in python language that need to improve performance. and we consider using pyjion to improve performance.

But if want to turn on pyjion, must be writtn the following code in the project

import pyjion
pyjion.enable()

But sometimes we can't change project code, so it's better to have a switch to turn on pyjion, instead of changing project code

firai commented 2 years ago

Maybe write a wrapper that enables pyjion and then calls the project code?

zhuofeng6 commented 2 years ago

maybe it is not a good idea, hope a switch to turn on pyjion, it is can set in the config file. What do you think? @tonybaloney