The generic lookup path has to do lot of extra stuff that we don't need for io path. You can diff and find out what are the extra stuff I have discarded here. You will see mostly the extra string manipulation. I can't change the interface because in such case I will end up rewriting lot of other code base that doesn't require performance optimization. In general, I don't see any harm if we have a separate fast path only for IO.

Even though lfn_generate_object_name()  is taking more cpu time, but to change that I need to touch the caller as well. For example, you will see, I am passing the string param by ref , instead of it is created and returned by the function itself.