Skip to content

Difference between using one jit call and multiple jit calls. #11471

Answered by sharadmv
uduse asked this question in General
Discussion options

You must be logged in to vote

In your first example, f and g will be compiled separately and there will be no compiler optimizations across them. In your second example, f and g will be part of one big compiled computation and there will be more opportunity for optimization. There will also only be one function call, which decreases dispatch overhead.

The caveat is that compiling two smaller functions can potentially be faster than compiling one big function, so you could save on compile time by splitting up your function into smaller compiled functions.

From personal experience, I recommend dropping a jit at the outermost level possible so the compiler has more opportunities to perform optimizations.

Replies: 1 comment

Comment options

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