| 1 |
.. _compilation-units: |
| 2 |
|
| 3 |
Compilation units |
| 4 |
================= |
| 5 |
|
| 6 |
When you run mypyc to compile a set of modules, these modules form a |
| 7 |
*compilation unit*. Mypyc will use early binding for references within |
| 8 |
the compilation unit. |
| 9 |
|
| 10 |
If you run mypyc multiple times to compile multiple sets of modules, |
| 11 |
each invocation will result in a new compilation unit. References |
| 12 |
between separate compilation units will fall back to late binding, |
| 13 |
i.e. looking up names using Python namespace dictionaries. Also, all |
| 14 |
calls will use the slower Python calling convention, where arguments |
| 15 |
and the return value will be boxed (and potentially unboxed again in |
| 16 |
the called function). |
| 17 |
|
| 18 |
For maximal performance, minimize interactions across compilation |
| 19 |
units. The simplest way to achieve this is to compile your entire |
| 20 |
program as a single compilation unit. |