c2compiler icon indicating copy to clipboard operation
c2compiler copied to clipboard

Use of std::vector, std::map/std::unordered_map

Open lerno opened this issue 6 years ago • 2 comments

This is related to #100 which usually occurs together with STL usage.

In my research std::unordered_map/std::map are not very efficient for the special cases we want to use them for. Consequently hash maps could be replaced by simpler replacements reducing compilation time and increasing efficiency.

lerno avatar Jan 29 '19 17:01 lerno

do you have specific instances which you want to replace?

bvdberg avatar Jan 31 '19 14:01 bvdberg

@bvdberg Well, the glaring problem is in the parsing code, but creating a custom hash and vector could then be reused across the codebase I think. Note that llvm's implementations like smallvector (allocates the vector on the stack unless it grows large – ideal for when collecting a list of attributes etc that is known to be small in the common case) can probably be a good alternative to rolling ones own alternatives.

lerno avatar Jan 31 '19 17:01 lerno