Skip to content

Compared to list,the operation 'at' of jax array may take longer ? #17283

Answered by jakevdp
jing-alice asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, thanks for the question. There's a section of the FAQ that's relevant: FAQ: Is JAX Faster Than NumPy. Although this focuses on comparing JAX to NumPy, the discussion is relevant here as well.

In short, JAX has relatively expensive per-operation dispatch costs. This doesn't really matter in practice, because in typical use you pay that dispatch cost only once per (JIT-compiled) program.

By contrast, Python has very low per-operation dispatch cost. This is important because in Python you must pay this cost for every operation in your program: there is no built-in JIT compiler to get around that.

Given this, when you compare very cheap operations like a single indexing op, you're essenti…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jing-alice
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