This is an archive of the discontinued LLVM Phabricator instance.

[RuntimeDyld] DenseMap -> std::unordered_map
ClosedPublic

Authored by loladiro on Nov 22 2015, 1:28 PM.

Details

Summary

DenseMap is most applicable when both keys and values are small. In this case, the value violates that assumption, causing quite significant memory overhead. A std::map is more appropriate in this case (or at least fixed the memory problems I was seeing).

Diff Detail

Repository
rL LLVM

Event Timeline

loladiro updated this revision to Diff 40888.Nov 22 2015, 1:28 PM
loladiro retitled this revision from to [RuntimeDyld] DenseMap -> std::map.
loladiro updated this object.
loladiro added a reviewer: lhames.
loladiro set the repository for this revision to rL LLVM.
loladiro added a subscriber: llvm-commits.

Any preference of map over unordered_map

I don't think it should matter. Will try it out.

loladiro updated this revision to Diff 41064.Nov 24 2015, 10:58 AM
loladiro retitled this revision from [RuntimeDyld] DenseMap -> std::map to [RuntimeDyld] DenseMap -> std::unordered_map.

Tested with unordered_map. Seems marginally better in my tests, but probably not statistically significant given my methodology. Still there's no reason the map should be ordered, so might as well use an unordered_map.

lhames accepted this revision.Dec 1 2015, 11:25 AM
lhames edited edge metadata.

LGTM. Thanks Keno. :)

This revision is now accepted and ready to land.Dec 1 2015, 11:25 AM
This revision was automatically updated to reflect the committed changes.