Add an ID to Symbol in order to make hashing faster
ClosedPublic

Authored by dfaure on Sep 19 2019, 8:18 PM.

Details

Summary

Before: 157M cycles, 252M instructions, 42.93 ms
After: 136M cycles, 165M instructions, 38.34 ms

Test Plan

perf stat -r ./bench_parser heaptrack.david.18594.gz
It still shows "365 entries, 2896 allocations"
as before (unlike whenever I introduced bugs, so this is a useful check)

Diff Detail

Repository
R45 Heaptrack
Branch
2019_09_use_unordered_map
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 16974
Build 16992: arc lint + arc unit
dfaure requested review of this revision.Sep 19 2019, 8:18 PM
dfaure created this revision.
dfaure updated this revision to Diff 66506.Sep 19 2019, 9:04 PM

Use unordered_map, otherwise this doesn't scale (this grows to >20k items)

dfaure updated this revision to Diff 66508.Sep 19 2019, 9:19 PM

Using std::tie for operator== is unnecessary overhead

dfaure updated this revision to Diff 66517.Sep 20 2019, 12:34 AM

Back to map for now, unordered_map in separate commit

dfaure updated this revision to Diff 66519.Sep 20 2019, 3:53 AM

cleanups

dfaure updated this revision to Diff 66520.Sep 20 2019, 3:56 AM
dfaure edited the summary of this revision. (Show Details)

Update stats

mwolff requested changes to this revision.Sep 20 2019, 4:04 AM
mwolff added inline comments.
src/analyze/gui/locationdata.h
31

quint64 or uint64_t please

src/analyze/gui/parser.cpp
111

I'd like to figure out why the unordered_map doesn't work and go there directly if at all possible. I don't see why it shouldn't work with that

alternatively: make this a sorted std::vector and then when no match was found, insert a new item and assign m_symbols.size() as new ID

This revision now requires changes to proceed.Sep 20 2019, 4:04 AM
dfaure added inline comments.Sep 20 2019, 12:04 PM
src/analyze/gui/parser.cpp
111

I fixed the bug I had with unordered_map, it works now, D24106.

Separating the commits was still useful to be able to debug why one worked and not the other :-)

Do you mean I should squash the commits, or it doesn't matter?

dfaure updated this revision to Diff 66550.Sep 20 2019, 4:26 PM

Use uint64_t

dfaure marked an inline comment as done.Sep 20 2019, 4:28 PM
mwolff requested changes to this revision.Sep 24 2019, 9:17 AM

please squash with the hash map commit

src/analyze/gui/parser.cpp
94–98

this will increment even when we don't insert anything - hm

probably not a problem, but I still would prefer if we would make this explicit somehow? could you at least add a comment that makes this clear?

This revision now requires changes to proceed.Sep 24 2019, 9:17 AM
dfaure updated this revision to Diff 66767.Sep 24 2019, 4:04 PM

integrate the use of unordered_map; redo measurements so they make sense after the changing of the order of the commits

dfaure marked 3 inline comments as done.Sep 26 2019, 8:36 AM
mwolff accepted this revision.Oct 2 2019, 3:15 PM
This revision is now accepted and ready to land.Oct 2 2019, 3:15 PM
dfaure closed this revision.Oct 3 2019, 8:19 AM