-
-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compile python files to reduce program startup time #1426
base: main
Are you sure you want to change the base?
Conversation
I think the checks fails because this PR makes python3 as a new build dependency, but I don't know how to fix this. |
Try add python to the .travis.yml python:
|
Travis is dead. I am in the process of updating carla to github actions, not finished. |
@falkTX great to hear about Actions, How this python dependency could be solved? Can we make it call any python version? |
@Houston4444 would be nice to have a benchmark showing the time gained in milliseconds and as percentage |
it needs to be python3 for sure, but detection for python is needed. so such block would be inside a check for frontend |
note that this is purely a startup optimization. |
@falkTX thats why i asked for some benchmark, so you could evaluate the ROI |
Isnt that what @Houston4444 did on the very first post? anyway, this is a very minor optimization and one that can easily break due to packaging differences in distros. |
Minor, yes, but appreciable. There is probably a way to use it if it works and not care if it doesn't. |
edcab1c
to
903ad4d
Compare
Hi.
The idea is to compile .pyc files in pycache at make install.
This reduce the startup duration of carla. When a python file is imported, python compiles this file in pycache/file.pyc . If this file already exists and matches perfecty with the python file version, then, python uses the compiled file. If we don't install theses compiled files, compilation is done at each startup because the dir is read only.
for comparaison, see the return without pycache of
time carla --version
and with pycache:
Note that the compilation is done at install, and not at make, else when files are moved, compiled files are not considered as matching with python files. It means that python checks if it matches with absolute paths.