Improve speed of internal ID access
octylFractal opened this issue ยท 1 comments
For thread-safety of #2114 I made BlockState#internalId
volatile
. However, this incurs a performance hit since the restriction here is stronger than we need. With 7.3.0, we can use VarHandle
instead to provide a much more efficient implementation using acquire/release.
amd64 is a vast majority of our end users, so this actually doesn't matter for most people, as mov
on amd64 is fully atomic anyways, so volatile
isn't any more expensive than the normal read. And I don't have access to an ARM CPU to check if it's any faster there.
VarHandles do incur a tiny overhead so I'm opting not to do this now.