`cdef` vs. `cpdef`: Key Performance Differences

The `cdef` keyword declares C-level variables and functions, offering the fastest execution by bypassing Python object overhead. `cpdef` creates functions callable from both Python and C, providing a good balance but potentially slower than pure `cdef` due to dynamic binding when dealing with Python objects.

Sources

Open the full topic