3 ms·
Not always. Computed gotos can be faster, because it can relax some restrictions that the switch statement can't amke. Most VM implementations, including CPytho
by Jasper_ 6y ago
Not always. Computed gotos can be faster, because it can relax some restrictions that the switch statement can't amke. Most VM implementations, including CPython, use computed gotos for a not insignificant performance improvement.
https://github.com/python/cpython/blob/master/Python/ceval.c#L967-L1004 https://github.com/python/cpython/blob/master/Python/ceval.c...