Storing LOAD_CONST value in inline cache? #404
Locked
Fidget-Spinner
started this conversation in
Ideas
Replies: 2 comments 2 replies
-
I tried this a couple of months ago, but I ended up abandoning the project as "not worth it". If I remember correctly, the cost of the (relatively large) inline caches more than offset any tiny gains made from removing the indirection. |
Beta Was this translation helpful? Give feedback.
2 replies
-
Also, just a small note: we're confident that all of the cache |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently
LOAD_CONST
is pretty fast, it indexes into an offset of a pointer to a tuple, then pushes a pointer.A random thought I had: what if we stored all the constants as
CACHE
following a LOAD_CONST. So it would look like:In theory, this could be even faster right? Accessing it would just mean incrementing the instruction pointer. This avoids the first pointer indirection we currently have. (Memory locality should also help it, since the
co_consts
tuple is somewhere else on the heap). The downside is that it's 4 non-dependent memory reads which may all be in cpu cache.This shouldn't take any additional memory at all, because we can get rid of
co_consts
.co_consts
can instead be a lazily generated tuple that we create on demand.Beta Was this translation helpful? Give feedback.
All reactions