[erlang-questions] where it's the best way to store a very big term object shared between processes

Adam Krupička <>
Thu Oct 22 13:19:34 CEST 2015


> Doing some benchmarks I see that lookup-ing for the longest prefix (btrie:
> find_prefix_longest) in around 100 K elements by prefix it's around 2- 5 ms
> and 95% of the time is spent in the ets:lookup.

This is because the trie is copied over from the ETS into the process
each time you access it. [1]
The gen_server approach would be more efficient; most efficient would be
storing a copy of the trie in each process (but also most memory
wasteful).


[1] http://www.erlang.org/doc/man/ets.html


More information about the erlang-questions mailing list