> static const char *real_path_internal(const char *path, int die_on_error) > { > - static struct strbuf sb = STRBUF_INIT; > + static struct strbuf resolved = STRBUF_INIT; Also by having this static here, it is not quite thread safe, yet. By removing the static here we cannot do the early cheap check as: > /* We've already done it */ > - if (path == sb.buf) > + if (path == resolved.buf) > return path; I wonder how often we run into this case; are there some callers explicitly relying on real_path_internal being cheap for repeated calls? (Maybe run the test suite with this early return instrumented? Not sure how to assess the impact of removing the cheap out return optimization) The long tail (i.e. the actual functionality) should actually be faster, I'd imagine as we do less than with using chdir. Thanks, Stefan