5 ms·
In the similar topic, I'm trying to find maps optimised for a small maximum number of items (8 or 16) indexed by integers. Curiously I failed to find discussion
by renox 7y ago
In the similar topic, I'm trying to find maps optimised for a small maximum number of items (8 or 16) indexed by integers.
Curiously I failed to find discussions about this topic..
But std::map seems very badly fit for this kind of map.
- matt_d 7y agoPerhaps it's worth considering succinct data structures (https://en.wikipedia.org/wiki/Succinct_data_structure https://en.wikipedia.org/wiki/Succinct_data_structure), e.g.: - BitMagic: http://bitmagic.io/ http://bitmagic.io/, https://github.com/tlk00/BitMagic https://github.com/tlk00/BitMagic - Succinct Data Structure Library 2.0: https://github.com/simongog/sdsl-lite https://github.com/simongog/sdsl-lite, https://github.com/simongog/sdsl-lite/wiki/Literature https://github.com/simongog/sdsl-lite/wiki/Literature
- renox 7y agoThanks but these structures are size optimised, I'm looking for CPU usage optimised structures.
- jdoerfert 7y agoDoes this sound interesting: http://llvm.org/docs/ProgrammersManual.html#llvm-adt-indexedmap-h http://llvm.org/docs/ProgrammersManual.html#llvm-adt-indexed... http://llvm.org/doxygen/IndexedMap_8h_source.html http://llvm.org/doxygen/IndexedMap_8h_source.html
- renox 7y agoI will have a look thanks. I think I'll implement it with two arrays one for keys one for values and a loop to find the key index, then return the corresponding value It may be better to fully unroll the loop, I'll have to benchmark this. SSE may be interesting too.