Cython - Static Type Declarations and Performance

Static Type Declarations and Performance

A Cython program that implements the same algorithm as a corresponding Python program may consume fewer computing resources such as core memory and processing cycles due to differences between the CPython and Cython execution models. On the one hand, a basic Python program is loaded and executed by the CPython virtual machine, so both the runtime and the program itself consume computing resources. On the other hand, a Cython program is compiled to C code, which is further compiled to machine code, so the virtual machine is used only briefly when the program is loaded.

Cython employs

  • Optimistic optimizations
  • Type inference
  • Low overhead in control structures
  • Low function call overhead

Since C is the intermediate language, performance will depend on the C compiler.

Read more about this topic:  Cython

Famous quotes containing the words type, declarations and/or performance:

    This type of man who is devoted to the study of wisdom is always most unlucky in everything, and particularly when it comes to procreating children; I imagine this is because Nature wants to ensure that the evils of wisdom shall not spread further throughout mankind.
    Desiderius Erasmus (c. 1466–1536)

    I judge a man by his actions with men, much more than by his declarations Godwards—When I find him to be envious, carping, spiteful, hating the successes of others, and complaining that the world has never done enough for him, I am apt to doubt whether his humility before God will atone for his want of manliness.
    Anthony Trollope (1815–1882)

    The value of old age depends upon the person who reaches it. To some men of early performance it is useless. To others, who are late to develop, it just enables them to finish the job.
    Thomas Hardy (1840–1928)