Best way to implement a simple cache

Thijs thijsterlouw@REDACTED
Fri Nov 13 02:17:18 CET 2009


On Nov 13, 8:36 am, Scott Lystig Fritchie <fritc...@REDACTED>
wrote:
> ... except that public/protected ETS table access isn't free, either.
> The VM has to play games with controlling multi-scheduler access to
> ETS's underlying hash table/binary tree.  I haven't measured with an
> R13B release, but with R12B-5 the cost was definitely non-zero and
> significant enough for us to change implementation in one case.

You are right, but in my experience a public ETS table significantly
outperforms process-mediated access. I'm curious how did you optimize
this further?
I found that accessing the ETS table is quite cheap (not zero indeed),
but the cost mainly depends on the size of the data you are accessing.
I have small values for each key and then access is really very fast,
without the complexities of the process (and queueing messages in it's
mailbox).




More information about the erlang-questions mailing list