is f_jit(x) different compared to jax.jit(f)(x) #8675
Answered
by
jakevdp
rozeappletree
asked this question in
Q&A
-
and
Is the difference significant |
Beta Was this translation helpful? Give feedback.
Answered by
jakevdp
Nov 24, 2021
Replies: 1 comment
-
The difference here is the time that it takes the
As for whether it's significant – it's a one-time cost of several tens of microseconds. When running microbenchmarks, this can be significant. If you're JIT-compiling a larger/more complex piece of code, it may not be significant compared to the cost of the full computation. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
rozeappletree
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The difference here is the time that it takes the
jax.jit
transform to do a cache lookup onselu
and construct & return a wrapped function. You can measure this more directly if you wish:As for whether it's significant – it's a one-time cost of several tens of microseconds. When running microbenchmarks, this can be significant. If you're JIT-compiling a larger/more complex piece of code, it may not be significant compared to the cost of the full computation.