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

Markus Neteler neteler at osgeo.org
Tue Mar 26 16:30:27 PDT 2019


Hi Panos,

On Thu, Mar 7, 2019 at 12:20 AM Panagiotis Mavrogiorgos
<pmav99 at gmail.com> wrote:
>
> 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

Do you have a patch available for the needed change?

thanks
Markus


More information about the grass-dev mailing list