Cython Fibonacci Sequence For my current job, I've been told that soon I'm going to be porting our Python code to Cython, with the intent of performance upgrades. In preparation of that, I've been learning as much about Cython as I can. I've decided that tackling the Fibonacci sequence would be a good start. I've implemented a Cython + Iterative version of the Fibonacci sequence. Are there any more performance upgrades I can squeeze out of this? Thanks!
fibonacci.pyx
cpdef fib(int n):
    return fib_c(n)

cdef int fib_c(int n):
    cdef int a = 0
    cdef int b = 1
    cdef int c = n
    while n &gt; 1:
        c = a + b
        a = b
        b = c
        n -= 1
    return c

And how I test this code:
testing.py
import pyximport ; pyximport.install() # So I can run .pyx without needing a setup.py file #
import time

from fibonacci import fib

start = time.time()
for i in range(100_000):
    fib(i)
end = time.time()
print(f&quot;Finonacci Sequence: {(end - start):0.10f}s (i=100,000)&quot;) # ~2.2s for 100k iterations
Using one less variable seems faster:
cdef int fib_c(int n):
    if n == 0:
        return 0
    cdef int a = 0
    cdef int b = 1
    for _ in range(n - 1):
        a, b = b, a + b
    return b

Running your test on my machine:
Original = 2.934 s
Improved = 1.522 s