[erlang-questions] Most performant way to store/search a bag
Thu May 3 07:38:55 CEST 2012
In your test script select does a full table scan, emulates foldl. But
your use-case is foldl through subset. Should you measure performance
of that case?
On 3.5.2012, at 7.57, Ulf Wiger <> wrote:
> 3 maj 2012 kl. 05:35 skrev AD <>:
>> gproc seems to use an ordered_set ETS table and then an ets:select() to match against the keys it needs. I did some basic tests with a 5 million row ETS ordered set table and ets:foldl still seems to come out faster.
> The key to good select() performance in an ordered_set table is to ensure that the first part of the key pattern is bound. In your test, the key pattern was a free variable, forcing the match spec evaluator to test every single record in the table.
> Gproc strives to do 'bounded selects' as much as possible.
> Ulf W
> Ulf Wiger, Feuerlabs, Inc.
More information about the erlang-questions