Performance tweaks

Various performance improvements focusing on optimizing hotpaths, reducing GC pressure, and preventing duplicate behavior.