Optimize creation of boxed primitives