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

Aaron Bawcom abawcom@REDACTED
Mon Aug 8 04:22:50 CEST 2011


1) For a lot of the binary keys the first 32 bits are zero which I believe may be optimized out from a memory perspective. I've seen this in other tests. But again, any savings there as far as memory size are visible in the numbers for both tests.
2) The memory sizes are what ets:info(tid()) returns
3) Yes an approximate 10% drop in speed matters.

Do you know the answer to the question? Why aren't there any binary pattern match conditions available in match specs? Is the answer simply "no one has needed them"?

-----Original Message-----
From: Jeff Schultz [mailto:jws@REDACTED] 
Sent: Sunday, August 07, 2011 8:38 PM
To: Aaron Bawcom
Cc: erlang-questions@REDACTED
Subject: Re: [erlang-questions] ETS: binary matching in match specifications

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 
> 3> 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