Sunday, 22 May 2022

jupyterLab %%timeit not consistent with python timeit

I wanted to test if type hinting had an influence on how long did the code take to run. It probably would add a tiny bit of time because the compiler has to ignore it, and that takes time but I wanted to see how unsignificant this was.

To do this, I executed this on jupyterLab: enter image description here

However, one of my classmates tried this without jupyterLab and found this: enter image description here

Does someone have an explanation as to why this would be happening?

Functions used:

def func(a, b):
    return a + b
func(6, 7)    

and:

def func(a: int, b: int) -> int:
    return a + b
func(6, 7)


from jupyterLab %%timeit not consistent with python timeit

No comments:

Post a Comment