[GRASS-dev] Compilation/Distribution of *.pyc files

Panagiotis Mavrogiorgos pmav99 at gmail.com
Wed Mar 6 15:20:29 PST 2019


In continuation of the previous message.

If the compilation of *.py files is indeed important, then copying the *.py
files into dist and issuing

python -m compileall ./dist.x86_64-pc-linux-gnu
>

is going to be orders of magnitudes faster (a single process that compiles
all the files vs creating a new process per *.py file). This is going to be
even faster if only a bunch of *.py files need to be compiled.

Just for comparison on my laptop (using Python 3):

- I need ~5 secs to run make on lib/python
- I need ~8 secs to run make on gui/wxpython
- while I only need ~1 sec to compile all the *.py files using compileall:

$ find ./dist.x86_64-pc-linux-gnu -name '*.pyc' -delete
> $ python -m compileall ./dist.x86_64-pc-linux-gnu
> [...]
>
python -m compileall ./dist.x86_64-pc-linux-gnu  1.10s user 0.11s system
> 99% cpu 1.214 total
>

Re-running compileall is nearly instantaneous:

python -mcompileall ./  0.07s user 0.03s system 99% cpu 0.101 total
>

So, unless someone can clarify why the compilation step is necessary, I
would suggest removing it.
If it is indeed needed, then I would suggest modifying the Makefile rules
to use compileall instead of plain compile

with kind regards,
Panos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20190307/eda4412a/attachment-0001.html>


More information about the grass-dev mailing list