From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: philip@warpmail.net (Philip K.) Newsgroups: gmane.emacs.bugs Subject: bug#40355: [PATCH] Implement caching for libravatar lookup Date: Tue, 31 Mar 2020 23:30:23 +0200 Message-ID: <87d08sp5zk.fsf@bulbul> References: <20200331180336.2999-1-philip@warpmail.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="32763"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 40355@debbugs.gnu.org To: Robert Pluim Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 31 23:31:22 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJOTi-0008PB-7K for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 31 Mar 2020 23:31:22 +0200 Original-Received: from localhost ([::1]:44308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJOTg-00039q-PD for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 31 Mar 2020 17:31:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35307) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJOTQ-00039Z-5k for bug-gnu-emacs@gnu.org; Tue, 31 Mar 2020 17:31:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJOTO-0006Il-DY for bug-gnu-emacs@gnu.org; Tue, 31 Mar 2020 17:31:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53832) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jJOTN-0006Hb-Tn for bug-gnu-emacs@gnu.org; Tue, 31 Mar 2020 17:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jJOTN-0005uV-Pk for bug-gnu-emacs@gnu.org; Tue, 31 Mar 2020 17:31:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: philip@warpmail.net (Philip K.) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 31 Mar 2020 21:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40355 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 40355-submit@debbugs.gnu.org id=B40355.158569024522660 (code B ref 40355); Tue, 31 Mar 2020 21:31:01 +0000 Original-Received: (at 40355) by debbugs.gnu.org; 31 Mar 2020 21:30:45 +0000 Original-Received: from localhost ([127.0.0.1]:37145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJOT1-0005tA-4J for submit@debbugs.gnu.org; Tue, 31 Mar 2020 17:30:45 -0400 Original-Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:52303) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jJOSy-0005sa-AX for 40355@debbugs.gnu.org; Tue, 31 Mar 2020 17:30:37 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 845E0363; Tue, 31 Mar 2020 17:30:30 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 31 Mar 2020 17:30:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=warpmail.net; h= from:to:cc:subject:in-reply-to:date:message-id:mime-version :content-type; s=fm3; bh=d5kouLmlUpSv1upvk9MUT1B6h5zc2Kia3OR7u6+ EoeQ=; b=nUIlPwLcLydAP9BgYfVlJswfKUfmEs/tksWZRBLgxOIUWNRjczH67MZ 9eQCug1sPECEy9mRuxXFPQd1veHuyECRoRVpcs33zFkfb6j1bfHPr3LrcOUJelpI AzC9mB/BlzjyikkoGrXnFHrofEH6ZoVOvaSzXjqFMz1/6/QufBEzIGiuiXLWvzkr nl9vdE3QeTP5J+XA7p0av2l3Jh3bcjMmERMbsvCxYvL0MDBufhUApQUjxEu+JemV NOzmdd93xci4RQss82BfWWAXq3bR3H+3rv772YYW5jpSgEZQdUWjX3zgI8XCQ4KY NufFePEeX2/psW3c0IlF9AwNzmNPm5g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=d5kouLmlUpSv1upvk 9MUT1B6h5zc2Kia3OR7u6+EoeQ=; b=yF4UKPmQ9HUGoHtV6eF7js3m5gIwfyE13 NyCRDo427J+4Ic5yZTZVHHFBmNAccrvMQkxZNsnV6jOoPQvn4sGIKWVjDlVdiSzp POyEPwYYm6sO+XaXVp/r4mOqdOluL9YOzWkBd61zXFyJpEHiIjdFl0h3XitmM4Ro y5Wu+KxyIcnA77C2DCO0oVpYQ8s3LCO3orQJ1phUDUarZzLQsrJZ1jnBDKlsOPYB mlaw8vVMRz6uiIKRp7ZXnDglOg5dJrNnewbPbUuMdosWq9SIrgquyCq9V6W5Dg9H Ip45H4lVHY3uZAebq3pSOXcz9mtEguOjSn5Y+O6ItJMhejLDOANfA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrtddtgdduvdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufgjfffkgggtsehttdertddttddtnecuhfhrohhmpehphhhilhhiphes figrrhhpmhgrihhlrdhnvghtucdlrfhhihhlihhpucfmrddmnecuffhomhgrihhnpegrth htrdhnvghtpdhfrggtvggsohhokhdrtghomhdpghhoohhglhgvmhgrihhlrdgtohhmpdgt ohhmmhgvrdgtohhmpdhmrghilhdrtghomhdpmhhsnhdrtghomhdpshgstghglhhosggrlh drnhgvthenucfkphepjeelrddvudelrdduleelrddufedtnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhhihhlihhpseifrghrphhmrghilh drnhgvth X-ME-Proxy: Original-Received: from localhost (p4fdbc782.dip0.t-ipconnect.de [79.219.199.130]) by mail.messagingengine.com (Postfix) with ESMTPA id 53DBE328005E; Tue, 31 Mar 2020 17:30:29 -0400 (EDT) In-Reply-To: (message from Robert Pluim on Tue, 31 Mar 2020 21:58:49 +0200) Autocrypt: addr=philip@warpmail.net; prefer-encrypt=mutual; keydata= mDMEXmoX2BYJKwYBBAHaRw8BAQdA/YuGV2Dy6UZtMk+KfA7Nnlj38k22KQ/+sXVa2ttGaHm0O1Bo aWxpcCBLLiAoZ2VuZXJhdGVkIGJ5IGF1dG9jcnlwdC5lbCkgPHBoaWxpcEB3YXJwbWFpbC5uZXQ+ iJAEExYIADgWIQSx6XCgW+bhLMR4DmPClWiPoyRe6AUCXmoX2AIbAwULCQgHAgYVCgkICwIEFgID AQIeAQIXgAAKCRDClWiPoyRe6IDNAP0eOlYoYIGVcCinuewkEb762T6lqA2hIHcNeRyX8LyQ8gEA krv4pIlZNLF+nBvaCtKvCPZF9428X50CvNvRHCNqgwe4OAReahfYEgorBgEEAZdVAQUBAQdACM09 XXce+t9YpOLbLdESh5g4RTY/0Zys7U1FapIZLA4DAQgHiHgEGBYIACAWIQSx6XCgW+bhLMR4DmPC lWiPoyRe6AUCXmoX2AIbDAAKCRDClWiPoyRe6LYcAQDn15KGn/E9MqloWN4mBJ7/tepYIk2IxrkZ imC531HsIAD+LKQYjorQosVe1oym0VZjmgKsem1kJZHG2tY601I+QwM= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:177930 Archived-At: Robert Pluim writes: >>>>>> On Tue, 31 Mar 2020 20:03:36 +0200, Philip K said: > > I doubt you need the 'cache' arg, you can keep the cache purely > internal. I added it because I was considering defining gravatar-libravatar-cache as (let ((cache (make-hash-table :test 'equal))) (dolist (domain '("aol.com" "att.net" "comcast.net" "facebook.com" "gmail.com" "gmx.com" "googlemail.com" "google.com" "hotmail.com" "hotmail.co.uk" "mac.com" "me.com" "mail.com" "msn.com" "live.com" "sbcglobal.net" ;; ... )) (gravatar--service-libravatar (concat "ignored@" domain) cache)) cache) with a few popular domains. The only issue is that evaluating it takes forever. > How big is this cache likely to get? Perhaps use a weak hash table? I haven't managed to gather good real-world data yet, but I would assume something along the lines of 50-200 domains? -- Philip K.