| 1 |
The ``--opt`` or ``-O`` translation option |
| 2 |
========================================== |
| 3 |
|
| 4 |
This meta-option selects a default set of optimization |
| 5 |
settings to use during a translation. Usage:: |
| 6 |
|
| 7 |
bin/rpython --opt=# |
| 8 |
bin/rpython -O# |
| 9 |
|
| 10 |
where ``#`` is the desired optimization level. The valid choices are: |
| 11 |
|
| 12 |
============= ======================================================== |
| 13 |
Level Description |
| 14 |
============= ======================================================== |
| 15 |
`--opt=0` all optimizations off; fastest translation `(*)`_ |
| 16 |
`--opt=1` non-time-consuming optimizations on `(*)`_ |
| 17 |
`--opt=size` minimize the size of the final executable `(*)`_ |
| 18 |
`--opt=mem` minimize the run-time RAM consumption (in-progress) |
| 19 |
`--opt=2` all optimizations on; good run-time performance |
| 20 |
`--opt=3` same as `--opt=2`; remove asserts; gcc profiling `(**)`_ |
| 21 |
`--opt=jit` includes the JIT and tweak other optimizations for it |
| 22 |
============= ======================================================== |
| 23 |
|
| 24 |
.. _`(*)`: |
| 25 |
|
| 26 |
`(*)`: The levels `0, 1` and `size` use the `Boehm-Demers-Weiser |
| 27 |
garbage collector`_ (Debian package ``libgc-dev``). The translation |
| 28 |
itself is faster and consumes less memory; the final executable is |
| 29 |
smaller but slower. The other levels use one of our built-in `custom |
| 30 |
garbage collectors`_. |
| 31 |
|
| 32 |
.. _`(**)`: |
| 33 |
|
| 34 |
`(**)`: The level `3` enables gcc profile-driven recompilation when |
| 35 |
translating PyPy. |
| 36 |
|
| 37 |
The exact set of optimizations enabled by each level depends |
| 38 |
on the backend. Individual translation targets can also |
| 39 |
select their own options based on the level: when translating |
| 40 |
PyPy, the level `mem` enables the memory-saving object |
| 41 |
implementations in the object space; levels `2` and `3` enable |
| 42 |
the advanced object implementations that give an increase in |
| 43 |
performance; level `3` also enables gcc profile-driven |
| 44 |
recompilation. |
| 45 |
|
| 46 |
The default level is `2`. |
| 47 |
|
| 48 |
|
| 49 |
.. _`Boehm-Demers-Weiser garbage collector`: http://hboehm.info/gc/ |
| 50 |
.. _`custom garbage collectors`: ../garbage_collection.html |