compile python files to reduce program startup time#1426
compile python files to reduce program startup time#1426Houston4444 wants to merge 1 commit intofalkTX:mainfrom
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
|
@Houston4444 I think it makes sense to have it in the github workflows... it's already there by now |
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 --versionand 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.