Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
feature request: support --jobs option for precompile command #24
precompile command is nice feature.
So I added the
@hhatto please review requirements for making substantive contributions for all projects under the Pylons Project:
Let us know if you have any questions.
Thank you @hhatto. Would you feel comfortable adding some narrative text to the documentation under Precompiling? If not, I can add it later, but it would be good to include it with this PR. Here's my suggestion (line wrapping at 79 columns is not required in narrative documentation):
However compilation is relatively slow compared with execution, so the first time a view is rendered may be very slow. To work around this first request latency we offer a command line script to pre-compile templates to python. To further speed up the precompilation, use the ``--jobs <integer>`` option with an integer specifying the number of parallel jobs to run on a multiprocessor computer. This is executed as follows: .. code-block:: bash $ CHAMELEON_CACHE=/path/to/put/precompiled/templates \ pyramid-chameleon-precompile --dir /path/to/look/for/templates \ [--jobs <integer>] With the ``--jobs`` option, the duration of compilation can be reduced by about one-third in projects with over 300 templates, as in this example using ``time``. .. code-block:: bash $ time CHAMELEON_CACHE=~/tmp_chameleoncache pyramid-chameleon-precompile --dir ~/template_files --jobs 1 INFO:root:Compiled 318 out of 318 found templates CHAMELEON_CACHE=~/tmp_chameleoncache pyramid-chameleon-precompile --dir 1 63.78s user 1.04s system 92% cpu 1:09.71 total $ rm -rf ~/tmp_chameleoncache/* $ time CHAMELEON_CACHE=~/tmp_chameleoncache pyramid-chameleon-precompile --dir ~/template_files --jobs 2 INFO:root:Compiled 318 out of 318 found templates CHAMELEON_CACHE=~/tmp_chameleoncache pyramid-chameleon-precompile --dir 2 78.24s user 1.07s system 172% cpu 45.959 total
I've requested review from the maintainers. At least one of them should review this PR before merging.