Войти в систему

Home
    - Создать дневник
    - Написать в дневник
       - Подробный режим

LJ.Rossia.org
    - Новости сайта
    - Общие настройки
    - Sitemap
    - Оплата
    - ljr-fif

Редактировать...
    - Настройки
    - Список друзей
    - Дневник
    - Картинки
    - Пароль
    - Вид дневника

Сообщества

Настроить S2

Помощь
    - Забыли пароль?
    - FAQ
    - Тех. поддержка



Пишет nancygold ([info]nancygold)
@ 2024-07-26 23:43:00


Previous Entry  Add to memories!  Tell a Friend!  Next Entry
Настроение: amused
Entry tags:computing

Surprisingly replacing

INLINE uint64_t PRFX(NH_PFX,,Hash_)(uint64_t key) {
  key ^= key >> 33;
  key *= 0xff51afd7ed558ccd;
  key ^= key >> 33;
  key *= 0xc4ceb9fe1a85ec53;
  key ^= key >> 33;
  return key;
}

with
INLINE uint64_t PRFX(NH_PFX,,Hash_)(uint64_t key) {
  return (key ^ (key >> 33)) * 0xff51afd7ed558ccd;
}

Makes the code setting 2**32 bits 20% faster.
Counter intuitive, since every one recommends stronger hash functions.
Guess that is another "security expert" thingie.
Because some hacker can spam your hashmap with collisions.
Which never happens in reality, because nobody cares about my apps.
Lesson learned: pay no attention to retards, especially renowned PhD retards.


(Читать комментарии) - (Добавить комментарий)


(Анонимно)
2024-07-27 01:08 (ссылка)
Btw, what's the level of compression you achieve with your bitmap thingie right now? Does it perform well with simulated data vs simple byte array approach already?

(Ответить) (Ветвь дискуссии)


[info]nancygold
2024-07-27 01:28 (ссылка)
It can handle a few millions entities in real-time.
And it is fast enough to do set intersections and unions.
These are most common operations in a game.
And attaching tags to objects is common too.
Relations like `A loves B` are also tags.
I.e. A is in a set of objects that love B.
In any case, order of magnitude better than what I had before.
That is, I used all 64 bits to store just a single bit.
Symta exposes it as a generic hashmap.
And it is auto promoted to a normal hashmap,
As soon as one of the value is not 1 (0 = No value).
Think https://en.wikipedia.org/wiki/Numerical_tower
But for hash maps.
Bitmap is the most basic of these.

(Ответить) (Уровень выше)


(Читать комментарии) -