[erlang-questions] Tuples referencing each other problem
Jesper Louis Andersen
jesper.louis.andersen@REDACTED
Mon Sep 25 17:48:54 CEST 2017
On Mon, Sep 25, 2017 at 8:35 AM Grzegorz Junka <list1@REDACTED> wrote:
> Fair enough, I missed that you can set ordered_set in ETS, but
> nevertheless it won't work with maps. However, even if I use ETS the Key is
> still stored twice, isn't? (once as the key for ordered_set, once as the
> value when the Id is the key).
>
>
It depends. If it is a large binary (larger than 64 characters) it will go
on the binary heap once unless you form it again and again in your code.
Otherwise it will take up the double amount of space.
We still don't know what the underlying problem statement is. This makes it
harder to solve because whenever we come up with a solution, a new
constraint is added and we have to adapt.
One advantage of using something like a gb_trees for the above is that you
only have the key once in the process heap and everything else will be
pointers. It is also possible to use the above scheme with gb_trees. But
then again, with ETS you can do key lookup from any process, whereas it has
to factor through the tree owner with gb_trees.
There is also the risk your problem is entirely too large to fit in memory
at all, but we don't yet know the size of your N and how large of a machine
you are willing to scale to, so it is hard to do any napkin math on the
size here.
In short, we need more info if we are to come up with a better solution :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170925/a0b43e84/attachment.htm>
More information about the erlang-questions
mailing list