vorner / contrie

Concurrent hash trie

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A map type based on cloning instead of arcs

vorner opened this issue · comments

Due to lifetime reasons (the crossbeam epoch is unpinned on method exit), we can't easily return references into the map. Currently, the ConSet clones the entries when returning. This is mostly fine for small/cheap types (ints, IP addresses) and an Arc can be used to handle types that can't be cloned or are expensive to do so.

The ConMap, on the other hand, integrates the Arc into itself directly. That's because the node contains both key and value and it is cheaper to clone (and store) only one Arc instead of two. But this is higher overhead for small/cheap types. So we probably also want a flavour of the data type (maybe CloneConMap) that clones K and V independently.

I expect the implementation to be highly inspired by both ConMap and ConSet. Some methods make no sense, though (like insert_entry), the methods should take either both key and value or just key (depending on the method), and return tuples.

If anyone wants to work on it, please claim it by commenting first, so the work doesn't get duplicated.

It's fine to do it in multiple merge requests, implementing only a subset first. Please include tests too (they too can be inspired by the other implementations, and we probably don't need the full set of what is on ConMap, because that one is used to also test the underlying Raw).

Don't hesitate to ask in case of need for help or questions.

Nice idea; I'll may give this a shot in the next days.

Hey @vorner , sorry for the long delay.
There is a draft here; probably is quite naive in a few spots and I'll think about it, but the overall shape should be there, very very close to ConMap.

This seems to be done :-).