8e5f550739562e1776a19a70efe59eb8754482f6
Palette has 4 implementations: global, hash, linear, and single. When only one implementation is being used (i.e all chunks loaded have sections with linear palette) the JIT can optimise the call to #valueFor quite well. When there are two implementations (i.e hash, linear) the JIT can still optimise the call but at a slight cost. However, when there are three or more in use (i.e linear, hash, single/global) the JIT cannot optimise the call and must revert to an interface invoke - which is terribly slow. In order to optimise this, we can extract an array for the hash, linear, and single palette implementations and perform lookups on the array directly instead of invoking
Languages
Java
100%