Skip to content

A simple loop is faster in python, adding types makes it 4-8 times slower #137

Closed Locked Answered by Mogball
mahmoudajawad asked this question in Q&A
Discussion options

You must be logged in to vote

The execution time you are measuring is entirely the notebook backend executing the code line-by-line. The loop doesn't execute at all -- it's optimized away since the body is empty. The time you are measuring is likely noise. In the first snippet, the type of mojo_t1 is already going to be Int, since it is inferred from the result type of now().

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by goldiegadde
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants