From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id BBl3KcQFV2DWaAAA0tVLHw (envelope-from ) for ; Sun, 21 Mar 2021 08:37:24 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id wLu5JMQFV2BUZAAAB5/wlQ (envelope-from ) for ; Sun, 21 Mar 2021 08:37:24 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2CCDF18204 for ; Sun, 21 Mar 2021 09:37:24 +0100 (CET) Received: from localhost ([::1]:47552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lNtaM-00068n-9y for larch@yhetil.org; Sun, 21 Mar 2021 04:37:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lNta1-00066R-TP for guix-patches@gnu.org; Sun, 21 Mar 2021 04:37:01 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41972) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lNta1-0000Iz-MC for guix-patches@gnu.org; Sun, 21 Mar 2021 04:37:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lNta1-0008N3-Jg for guix-patches@gnu.org; Sun, 21 Mar 2021 04:37:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47288] [PATCH] guix: http-client: Tweak http-multiple-get error handling. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 21 Mar 2021 08:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47288 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Christopher Baines , 47288@debbugs.gnu.org Received: via spool by 47288-submit@debbugs.gnu.org id=B47288.161631582032170 (code B ref 47288); Sun, 21 Mar 2021 08:37:01 +0000 Received: (at 47288) by debbugs.gnu.org; 21 Mar 2021 08:37:00 +0000 Received: from localhost ([127.0.0.1]:53518 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lNta0-0008Mm-DD for submit@debbugs.gnu.org; Sun, 21 Mar 2021 04:37:00 -0400 Received: from xavier.telenet-ops.be ([195.130.132.52]:44156) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lNtZx-0008Mb-Jy for 47288@debbugs.gnu.org; Sun, 21 Mar 2021 04:36:59 -0400 Received: from ptr-bvsjgyjmffd7q9timvx.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d]) by xavier.telenet-ops.be with bizsmtp id iwcv2400A0mfAB401wcvU0; Sun, 21 Mar 2021 09:36:55 +0100 Message-ID: <70ae9918cfe06c3dcce6764f170a96b55e275d4d.camel@telenet.be> From: Maxime Devos Date: Sun, 21 Mar 2021 09:36:42 +0100 In-Reply-To: <20210321004338.31867-1-mail@cbaines.net> References: <20210321004338.31867-1-mail@cbaines.net> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-93KPs4P3me86xyvi8Jnh" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1616315815; bh=wDJIwqPz5lBhxdv1/NryrzlDvMaBiyQpWTmyOCsPezE=; h=Subject:From:To:Date:In-Reply-To:References; b=VAO+PUzg7PavK78QEJZmQFf6PuvIdxJlngiu2z/BI3sA+TI84R3Qwjf+4vmw7p4/0 e3K/zuAjo3ayagHoVwewS6WXLyVqA9jkreA2drrB9J7negv1qbJgPNf0xacSAFCo3t +kMsNWN6BZdu3KbEEYgJhHWvyZbQSwJfQXgH8gjB9fQJ+8ahvQ3BBG4Vo4mRpLzMyl hoKRSZCiv+iss22OOT/u4HW8l8E+LifT8gUMywzVjqCuGs5gCS73RhlkSJOuq24JjA MbzOY9ZYwdFJWPPDwc1pSrn1Ls1m8zI/CycnFL5Ve/HGZYIZOeO0MgvM2ByuO6g3wn 3xANGBLHa1WWQ== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1616315844; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=wDJIwqPz5lBhxdv1/NryrzlDvMaBiyQpWTmyOCsPezE=; b=ZQceJUqt04eTWDvoDy2/EX6fXUu8zJ+EPRkcO8dkv2fYv4ZwwylVdSzEzXs5/tbGS0P9HU IpVjCSaGshvn0L2rkMH5b0/1Duo7YDMm6dnKAVO0AQR0hDZP9Cjy2PSYG9OhRUa+9ECOnK t0KoclMKRhnEAT8OqbdtYR/a4k4YKY7jVQincTeI8lnlyFV5EMppNgfRQ3KCTK4XCWui+j 0yoa52MlCcUhN3JrrVf5lN8XtgPgWbxNxxNBkg6cQxt/R47oyxOvK+08tBnaG3RU6Of4uO xTu4mo1Q+cusguL/sqZGpf4x60DN2IjU0qyrodin4r2spV7++yNa9x5xHwXlKA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1616315844; a=rsa-sha256; cv=none; b=KFPpC2apIrC37WnIj6blm1Bxcf4cupAg0+Y9iR9u06sQwwfn4E40EXBQjnOJ5GnQFKQIZo ap1svCZ24R11Z594AtPjyie704XluYkj4JPDHvKSo0gEZzXbs/XT5czCccCnPAbKtGl4mZ JwgGnaQuoHLFTCiPVLRYjckkma9df2AHhfZFha0D4H4trlTZ3FIVkva2WHiCuDQlQ+ewYo uUPmBxt1OL2lk39OcINVC7Ry06OeorJJzzMwIUSzD6pAu9La3tB9jrd2WN7WevwAb5CdTM S81tiHDnOMXtIj7sNhZQ1qCwLZpdolbC4AUiI968xevXrQiicaAf54zDV6ErnA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=VAO+PUzg; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -3.42 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=VAO+PUzg; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 2CCDF18204 X-Spam-Score: -3.42 X-Migadu-Scanner: scn0.migadu.com X-TUID: XxcEA5yKFUlN --=-93KPs4P3me86xyvi8Jnh Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, 2021-03-21 at 00:43 +0000, Christopher Baines wrote: > This isn't meant to change the way errors are handled, and arguably makes= the > code harder to read, but it's a uninformed attempt to improve the > performance (following on from a performance regression in > 205833b72c5517915a47a50dbe28e7024dc74e57). >=20 > I'm guessing something about Guile internals makes calling (loop ...) wit= hin > the catch bit less performant than avoiding this and calling (loop ...) a= fter > the catch bit has finished. Since this happens lots, this seems to be > sufficient to make guix weather a lot slower than it was before. I took a look at the code, and it seems we did somthing like: (let loop VARS (match sent NON-LOOPING-CASES (STUFF (catch #t THUNK-THAT-MIGHT-CALL-LOOP-IN-TAIL-POSITION SOME-HANDLER-THAT-DOES-NOT-CALL-LOOP) A small demonstration of what could go wrong with such a construction (run this in the Guile REPL): (let loop ((attempts-todo 20)) (catch 'oops (lambda () (if (<=3D 0 attempts-todo) (loop (- attempts-todo 1)) (throw 'oops))) (lambda _ (display 'too-bad!) (newline) (backtrace)))) Output: too-bad! Backtrace: In ice-9/boot-9.scm: 1731:15 19 (with-exception-handler # _ # _ =E2=80=A6) [The previous line repeated 17 times] 1731:15 1 (with-exception-handler # _ # _ =E2=80=A6) In unknown file: 0 (backtrace #) With this construction, we were nesting exception handlers within exception= handlers ... So in hindsight it doesn't seem surprising this isn't very performant. (THUNK-THAT-MIGHT-CALL-LOOP-IN-TAIL-POSITION itself is not called in the ta= il-position of the '(let loop ...)' form.) Hope that sheds some light on the matter, Maxime --=-93KPs4P3me86xyvi8Jnh Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYIADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYFcFmhccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7uELAPwLbkh01qJqniid0xELzUrLgGhz Jqe9NbVxRRcY42SmygEAgz/0DZPmVAoBbxJVUXxGl/J+FVtGrSEmH2atCjL5gQA= =8t1s -----END PGP SIGNATURE----- --=-93KPs4P3me86xyvi8Jnh--