Pick performance optimiziations from UnicornButter