[erlang-questions] ETS: binary matching in match specifications

Jeff Schultz jws@REDACTED
Mon Aug 8 02:38:27 CEST 2011


On Sun, Aug 07, 2011 at 08:08:43PM -0400, Aaron Bawcom wrote:
> % Col1 == Number of elements in table

> % Col2 == Memory size of table

> % Col3 == Average ets:member/sec for 10M lookups

> 1> test:do_ets_test(). % Using 4 segment 128bit Binary for Key lookup

> 1279, 16937, 5882352

> 3> test:do_ets_test(). % Using 4 element tuple of integers for Key lookup

> 1279, 15658, 5479452

There's something missing in these memory figures.  128b is 16 byte.
16937/1279 = 13.24, 15658/1279 = 12.24.  Doesn't look like these
figures include the keys.  (Hmm, 16937-15658 = 1279.  Looks like the
reported memory use is exactly 1 byte / element more for the binary
key version.)


In any case, the performance difference you show between the two
versions isn't large.  Does it matter that much?


    Jeff Schultz



More information about the erlang-questions mailing list