From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QFkZFvO/7mDeegEAgWs5BA (envelope-from ) for ; Wed, 14 Jul 2021 12:44:03 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id qKXcEfO/7mBJDwAAbx9fmQ (envelope-from ) for ; Wed, 14 Jul 2021 10:44:03 +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 EDCF414F66 for ; Wed, 14 Jul 2021 12:44:02 +0200 (CEST) Received: from localhost ([::1]:51254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m3cMz-0000V1-Kv for larch@yhetil.org; Wed, 14 Jul 2021 06:44:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3cL3-0007fg-T9 for guix-patches@gnu.org; Wed, 14 Jul 2021 06:42:01 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59743) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m3cL3-00079I-Ka for guix-patches@gnu.org; Wed, 14 Jul 2021 06:42:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m3cL3-0006oB-JA for guix-patches@gnu.org; Wed, 14 Jul 2021 06:42:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49547] [PATCH v2 2/4] home-services: Add home-run-on-change-service-type Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 14 Jul 2021 10:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49547 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Andrew Tropin , 49547@debbugs.gnu.org Received: via spool by 49547-submit@debbugs.gnu.org id=B49547.162625931326157 (code B ref 49547); Wed, 14 Jul 2021 10:42:01 +0000 Received: (at 49547) by debbugs.gnu.org; 14 Jul 2021 10:41:53 +0000 Received: from localhost ([127.0.0.1]:43056 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m3cKu-0006np-Rv for submit@debbugs.gnu.org; Wed, 14 Jul 2021 06:41:53 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:49804) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m3cKs-0006nf-N2 for 49547@debbugs.gnu.org; Wed, 14 Jul 2021 06:41:51 -0400 Received: from butterfly.local ([188.188.219.228]) by baptiste.telenet-ops.be with bizsmtp id Uyho250024wFxCU01yho4V; Wed, 14 Jul 2021 12:41:49 +0200 Message-ID: From: Maxime Devos Date: Wed, 14 Jul 2021 12:41:35 +0200 In-Reply-To: <875yxem679.fsf@trop.in> References: <875yxem679.fsf@trop.in> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-mkytba5u9lUi6lMxzjLA" 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=1626259309; bh=ygaCzqA4H65mnD9pVF+X4Gd9vA7VzjqB5RVp/uRUPqE=; h=Subject:From:To:Date:In-Reply-To:References; b=SAVPas7ZA78StCVUSDCRw0hCj9xAKydB+EZ9RUDfW/sGdaeOAUab4v0wsBUs9lUe0 af0O7bmOOHb+XizLoPGq1VJQ7/x3ab3k036fPjBza+fEENgqNv+7hipLLgyK3clEDW Tw4Y1CyWGuGW/nJxA8BxAgUjfpR/hC6EEy2sjb/RNx2chcIS1XbvlR8v+dmHWLb7co RDB5btVdygly0qAK/+0QsBEEfzs3VafCpD0B11NE8q5kmhgo0NZkJ4iASQvkpQoEp5 N0kTdFOpNvZXJnpf/5kbS7Niua1sYz+5dRY3G4c/GjfaPQBbL3q9rLU/Sb+KqX8IHN jVjFP/0K5Nk+A== 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=1626259443; 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=ygaCzqA4H65mnD9pVF+X4Gd9vA7VzjqB5RVp/uRUPqE=; b=UQzzq6nGQ+TpSN1PdaosNx2hwBLWziVLEsI/ZNOh9EQmagn2TbP/jNU5CNuiR6/WsGXX4K 5gGg3kxqyuHVRi1UjkuQHkXsREME3ARlF4aCDxRK6gCu3TOrCPfqnXR6WU6ChJotQCJ7Yr qHffca6OfD7TYXr43lhyWxBC0QfwErzLeKxnSHb2TiiRRPnGtcSwrKFG0ElZGkbnRb+rYC 0SvRuE9PLi1pZapBk1aAr1yXwLZ7gymqR/sxb+zZuGtqMRprvhJsIaHXpa/u9k4Ft6CzRs C89pElI0y0qQD/YL08oyZrRayEL3x8H3Vlsa9lbzuXCh4zhQGXCeE+jeP3H63A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1626259443; a=rsa-sha256; cv=none; b=D+AGoLz9iyIn7nn4N+yjAF+fnZCKBA3gzvb2M3tcYoGzr4AqEk7IhIzOhmV/IAV6jYKlpV bT9z7YhDubGnTE8tgQ7bGnubL9silhXdBlwp2S8g32AqExaAddOzIvjNT8nCk5ijqX5rXj oVfie0dnbZ6WncGx8Jbk0xOrNGFNiLKTeSoZ0OxNJt2tXSSV1ueFoP+XhepiUT00tWRbyq YOZ+TtYJJ5C0a9dDL/jmI3Af47ZTlGeCZRCBK7awGgTc93AvplwlpUW6nyaAMqNeyJhgun 2PBgAd7IO6stkiOuGWSX+4EI1XV+yXV5I8XFpAXs89xfjbQhL9IoTYUm+mSkYA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=SAVPas7Z; 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.40 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=SAVPas7Z; 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: EDCF414F66 X-Spam-Score: -3.40 X-Migadu-Scanner: scn0.migadu.com X-TUID: /XgSBAcuHsHF --=-mkytba5u9lUi6lMxzjLA Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Andrew Tropin schreef op ma 05-07-2021 om 18:39 [+0300]: > + (define (equal-regulars? file1 file2) > + "Check if FILE1 and FILE2 are bit for bit identical." > + (let* ((cmp-binary #$(file-append > + (@ (gnu packages base) diffutils) "/bin/cm= p")) > + (status (system* cmp-binary file1 file2))) > + (=3D status 0))) Is there any particular reason to shell out to "cmp" instead of doing the comparison in Guile? Starting a process isn't the most efficient thing. Try "time /run/current-system/profile/bin echo", on my system, it takes about 2--3 milliseconds for "echo" to finish even though it only had to print a newline character. Compare with "time echo" (to use the shell built-in "echo"), it takes 0.000s seconds on my system. 3 milliseconds isn't much by itself, but this can accumulate, so I would implement the comparison in Guile. As an optimisation, you could look at the value returned by "lstat". If the 'size' is different, then 'equal-regulars?' can return #f without reading the file. If the 'inode' and 'device' are equal, then 'equal-regulars?' can return #t I think (at least on conventional file systems like btrfs and ext4). Greetings, Maxime. --=-mkytba5u9lUi6lMxzjLA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYO6/XxccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7n/oAP466Q+yNDWKN85lWBzh23gFcgJl jrkXgXv4gkpEv3VRIgD/QDFM7IlVUX9HSbQLJfKHjSZ7HfYDCsi7PabVpzizfwI= =I3D3 -----END PGP SIGNATURE----- --=-mkytba5u9lUi6lMxzjLA--