Похожие чаты

Why is there dense and sparse?

2 ответов

7 просмотров

It is a part of implementation of sparse set (the main part is in src/lib.rs file). Basically there are 3 arrays: - dense array of packed data - dense array of back-references to sparse keys (needed to maintain removals) - sparse array of indexes to dense array The idea of a sparse set, that it provides O(1) access by keys without hashing, and at the same time allows to get benefits of cache-friendly packing of values for iteration over them. The twist of this specific implementation, is that it generates the key when the element is inserted and provides it back (so it basically acts as a limited implementstion of Vec, but to index specific element, one supposed to store a struct instead of a raw index). The reuse of keys is done using a "free list" (basically making a linked list of removed sparse elements using the memory of those elements). To make sure old keys can't be used with new elements when sparse elements are reused, they store an 'epoch', which is just an number of times they were reused.

Thomas- Автор вопроса

Похожие вопросы

Обсуждают сегодня

Всем привет, написал код ниже, но он выдает сегфолт, в чем причина? #include <stdio.h> #include <stdlib.h> #include <string.h> struct product { char *name; float price; };...
buzz базз
75
I love the passion, really do. I do think this is being blown way out of proportion. We are not deleting our Telegram or not allowing you to talk about anything you want, a...
Mike Herron
3
Did you guys see the latest tweet from TonGifts? 🚀
Mike
44
Hey guys, did you see the latest announcement about $FUN? 🔥
Brian
21
Question: when will have qnt holders a tool to stake tokens in lcx? Answer, Verdian: yes soon.
David Ch
14
Did kadena deliver anything on time?
Femboi Uwu
23
А как лучше конвертировать физический адрес в виртуальный при маппинге? В случае ядра у меня, например, direct mapping, первые 768МБ я как есть мапплю в higher half, а остальн...
Evg Resh
26
Всем привет, подскажите/посоветуйте пожалуйста. Фаердак компоненты, имею одно место где бизнес хочет видеть при открытии формы список всех клиентов, это порядка 30к. Мои дово...
Sasha Sch
14
Ребят, если кто в курсе - скажите, а в загранке такое же засилье маркетплейсов? или там простые сермяжные интернет-магазины живут попроще?
Андрей [aharito] Харитонов
14
Коллеги, доброе утро. Запустил на удаленном хосте приложение (ручками зашел туда по ssh и запустил, не командой удаленно). Создал потом ssh-туннель, и с моей машины приложение...
Δημήτηρ
9
Карта сайта