Subject: bug#40355: [PATCH] Implement caching for libravatar lookup

From: Robert Pluim <[email-masked]>
Date: Wed, 01 Apr 2020 09:27:00 +0200

>>>>> On Tue, 31 Mar 2020 23:30:23 +0200, [email-masked] (Philip K.) said:

    Philip> Robert Pluim <[email-masked]> writes:
    >>>>>>> On Tue, 31 Mar 2020 20:03:36 +0200, Philip K <[email-masked]> said:
    >> 
    >> I doubt you need the 'cache' arg, you can keep the cache purely
    >> internal.

    Philip> I added it because I was considering defining gravatar-libravatar-cache
    Philip> as

    Philip>     (let ((cache (make-hash-table :test 'equal)))
    Philip>       (dolist (domain '("aol.com" "att.net" "comcast.net" "facebook.com"
    Philip>                         "gmail.com" "gmx.com" "googlemail.com" "google.com"
    Philip>                         "hotmail.com" "hotmail.co.uk" "mac.com" "me.com"
    Philip>                         "mail.com" "msn.com" "live.com" "sbcglobal.net"
    Philip>                         ;; ...
    Philip>                         ))
    Philip>         (gravatar--service-libravatar (concat "ignored@" domain) cache))
    Philip>       cache)

    Philip> with a few popular domains. The only issue is that evaluating it takes
    Philip> forever.

Perhaps thatʼs a sign that pre-population is not needed :-)

    >> How big is this cache likely to get? Perhaps use a weak hash table?

    Philip> I haven't managed to gather good real-world data yet, but I would assume
    Philip> something along the lines of 50-200 domains?

OK, I donʼt think thatʼs onerous.

Robert