Why didn't you apply these CPU optimizations to the normal lfn_generate_object_name()? It would be an easy change to replace it, and just pass in an optional string pointer which would be used for the path manipulation if present (as it is in this implementation).