This is an archive of the discontinued LLVM Phabricator instance.

Use StringRef's in resolved path cache to avoid extra internString lookups
ClosedPublic

Authored by pete on Mar 17 2016, 5:59 PM.

Details

Summary

Hi Fred

ResolvedPaths was storing std::string's as a cache. We would then take those strings and look them up in the internString pool to get a unique StringRef for each path.

This patch changes ResolvedPaths to store the StringRef pointing in to the internString pool itself. This way, when getResolvedPath returns a string, we know we have the StringRef we would find in the pool anyway. We can avoid the duplicate memory of the std::string's, and also the time from the lookup.

Unfortunately my profiles show no runtime change here, but it should still save memory allocations which is nice.

Cheers,
Pete

Diff Detail

Repository
rL LLVM

Event Timeline

pete updated this revision to Diff 51004.Mar 17 2016, 5:59 PM
pete retitled this revision from to Use StringRef's in resolved path cache to avoid extra internString lookups.
pete updated this object.
pete added a reviewer: friss.
pete set the repository for this revision to rL LLVM.
pete added a subscriber: llvm-commits.
friss accepted this revision.Mar 17 2016, 6:26 PM
friss edited edge metadata.

LGTM, thanks Pete!

This revision is now accepted and ready to land.Mar 17 2016, 6:26 PM
This revision was automatically updated to reflect the committed changes.
pete added a subscriber: pete.Mar 17 2016, 8:53 PM

Thanks for the quick review! r263774

Pete