Hi Fred
getFileNameByIndex calls sys::path::append and (transitively) malloc a large number of times.
The call site in getChildDeclContext already caches resolved paths for a given FileNum if we have the file name by its index.
This patch adds a hasFileNameByIndex method. getChildDeclContext can first call this method, and if it returns true it knows it can then lookup the resolved path cache for the given file index. If we hit that cache then we don't even have to call getFileNameByIndex.
Running dsymutil on the swift executable generated from the GitHub sources, before this change took 100s on my iMac. Afterwards took 80s. So a nice 20% speedup. I ran a few times on each configuration to make sure the numbers are quite stable. I also diffed the dSYM produced before and after this patch and they are binary identical.
Thanks,
Pete
I know you modeled the name on the function below, but it reads strange to me. How about just
(ie also drop the Kind parameter, I don't think it makes sense to test it here.)