compilation_units.rst 826 B

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