I am working on some Java code which needs to be highly optimized as it will run in hot functions that are inv