Robin Hood Hashmaps

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 4

  • @MikeDawson1
    @MikeDawson1 17 дней назад

    why would you want to use a hashing function that has so many collisions that multiple keys arrive on the same bucket? is that normal for all hashmaps?

    • @GetIntoGameDev
      @GetIntoGameDev  17 дней назад +1

      If no collisions occur then everything’s all good. It’s most important that hashmaps have a reasonable strategy for handling collisions. As for the hashing function, this isn’t the best but I chose it for quick computation 😅

    • @buzzy4227
      @buzzy4227 17 дней назад

      I’m not an expert, but I imagine for games performance is a bigger concern. Good hashing functions might be too complex or eat up too much memory.
      I can also think of a use case where maybe you want your function to collide for similar types of entities.

    • @GetIntoGameDev
      @GetIntoGameDev  17 дней назад +1

      I may have missed some parts of my explanation. The point of a hash function is to convert arbitrary objects into unique integers, but in an entity component system we already have the guarantee of unique integer ids. The modulus operation has to happen anyway to avoid going out of array bounds, power of two sizes just makes it simpler.
      As for prioritising bucket positions for certain entities, it’s possible in some cases but in an entity component system there is literally meant to be nothing special about the components. They’re just data which can be queried, everything is consumed and processed the same way.