[erlang-questions] Most performant way to store/search a bag

Ulf Wiger ulf@REDACTED
Thu May 3 06:57:32 CEST 2012

3 maj 2012 kl. 05:35 skrev AD <straightflush@REDACTED>:

> 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 mailing list