`cpdef` vs. `cdef`: The Minor Speed Cost for Python Compatibility

While `cpdef` functions offer C-level speed, they introduce a slight calling overhead, often less than a nanosecond, compared to pure `cdef` functions due to internal checks for Python overriding and dynamic binding when handling Python objects.

Sources

Open the full topic