[erlang-questions] Benchmarks (Was: Question/Alternative on Frames Proposal)

Jan Burse janburse@REDACTED
Mon May 21 10:53:18 CEST 2012


Richard O'Keefe schrieb:
>
> On 19/05/2012, at 8:57 AM, Garrett Smith wrote:
>>
>> I apologize, this is somewhat off topic and not an answer to your question...
>>
>> But does anyone know where the Frames proposal stands vis-a-vis the
>> OTP team's work on hashes?
>
> I'm not sure what you are asking.  The paper that you mentioned made it
> quite clear that they were NOT experimenting with frames or anything in
> the same area of design space.
>

Hi Richard,

If I remember well, your proposal mentions some benchmarks
with monomorphic caching. You also explained the SmallTalk
history of caching methods. So basically I suppose someone
is doing the following:

    if (cache == null || cache.base != base)
        cache = lookup(base,key);  /* costly */
    return cache;

Since last week I have been experimenting with polymorphic
caching. And it seems that is practically same speed as
monomorphic caching, but has the additional advantage of
not trashing the cache.

Trashing of monomorphic cache happens when the base
is not constant for a call site. When trashing happens
time spent goes drastically up. I observed for some
test case of mine:

     No Trashing: 1400 ms
     Trashing: 2200 ms

So I did a very simple polymorphic cache consisting of a
a single linked list. Its adding new entries at the end
of the list if it didn't find an entry with matching
base. Its not that bad:

     Monomorphic: 1400 ms
     Polymoprhic: 1450 ms

I am not using some locking. Its just overwriting the
the last link with a new entry, so concurrently it might
do double work sporadically, but the result should never
be wrong. But it requires GC of the eventually lost record.

Something done for Erlang records?

Bye




More information about the erlang-questions mailing list