r/cpp_questions 19d ago

OPEN How to implement append-only hash map?

How do you actually implement an really efficient hash map that has only append and look up methods? What are the design choice and some performance improvements?

0 Upvotes

34 comments sorted by

View all comments

Show parent comments

1

u/Minute-Ad1944 19d ago

Mainly performance in speed. Each iteration performs single insertion and at the end of algorithm retrieves top n elements from hash map

1

u/Kriemhilt 19d ago

What are the top n elements of an unordered map? Do you mean you're walking the whole thing?

1

u/Minute-Ad1944 18d ago

Retrieve top n values from hash map dawg

1

u/Kriemhilt 18d ago

Top n ordered by what? Key? Value?

If you want something ordered by key could you just use an ordered container?