From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id WJcHLHU2lGJ9cQAAbAwnHQ (envelope-from ) for ; Mon, 30 May 2022 05:13:57 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id +GfTK3U2lGIKdAAAauVa8A (envelope-from ) for ; Mon, 30 May 2022 05:13:57 +0200 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 3AD7DB6C1 for ; Mon, 30 May 2022 05:13:57 +0200 (CEST) Received: from localhost ([::1]:40814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nvVqt-0006Qp-RB for larch@yhetil.org; Sun, 29 May 2022 23:13:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nvVqP-0006Qg-Es for emacs-orgmode@gnu.org; Sun, 29 May 2022 23:13:25 -0400 Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]:33589) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nvVqN-00036V-Qx for emacs-orgmode@gnu.org; Sun, 29 May 2022 23:13:25 -0400 Received: by mail-qk1-x731.google.com with SMTP id 199so307606qkk.0 for ; Sun, 29 May 2022 20:13:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=m8VWDdbCpPMP8BwOtyHkHZguY5Jb3z8ahKtb98pofyQ=; b=nopPdDOSgHQg3u4n/iqSdNsvUwvI4t4bk+kyCeG9Tydn5FmBJDOXFfE0KPtAZvPypi w2/PtyoqZ6XKqrP3h6XNYShwv62JlEdVHWqQOADy2cjkkrKOz5lyqMHza24ES2iVt+yY z2K7HVufZJxW6nq3FGsxIRXs9AVjJ+Z9f1p5uW/20qhE9o379lHW1nNPsgDnYl/MBj0W IWcPaD9S49xSr8W1sQYIKlE9pSdba+Ll+Oum+UmzUmWzAuPNpgl9ZvK7hZwoPz6mldey o2A55A1AgAFYtJIp2foh4O2LP+LldO59WH6bBTeYy+E1QSx4nXaoUYB6zAKNwOTZjT+m hXew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=m8VWDdbCpPMP8BwOtyHkHZguY5Jb3z8ahKtb98pofyQ=; b=ZCEykuTL4qM2B+eHHEOnw3pCAt0h2TzPOEU9H9Sl6CAQRI72egjTfNlJ8/oVj9RKBn he2rF85S66t+BTwaL+AsYR6tWGJ9CTGlTDtNRgwo2G2CBsYEII+tC3Nm6vbiNQ/Rd/GK cRoLwGL5CSrJ1MXUheysE9KKm4DtqN2BI7Vl8fcY2GPQatJ8mNwEwQFByx7EFasQfyzH /ZhhX4CIXopBOXNWlXXiJUDqjWnRDNUXgIblOt6pCiDA2aPOyOWd9OT5emwgsYGgDU7A P4vTeMlK0To3xmcMBe9h8ompIFc/BYZM7iDK7XyIdiCV0lCDOVWLvkugV2dHYgnQPTrH aMgQ== X-Gm-Message-State: AOAM533Y1UQlyaRrm/dD6CEAo1bUP+73jIeRyKl+W5at6zKyLPt89fuk C953vecB+DPBcPFbnLUr0GE= X-Google-Smtp-Source: ABdhPJyYgG50HoYMsOSq2CDG0WiTgWYakWICJqKmbZq6Ii30afkZuaQaHT2YhQQAnY46SEiDNS/e8g== X-Received: by 2002:a37:8741:0:b0:6a6:2a43:ec8e with SMTP id j62-20020a378741000000b006a62a43ec8emr2476872qkd.398.1653880402824; Sun, 29 May 2022 20:13:22 -0700 (PDT) Received: from localhost (22.b2.a86c.ip4.static.sl-reverse.com. [108.168.178.34]) by smtp.gmail.com with ESMTPSA id z207-20020a3765d8000000b0069fc13ce23esm7038322qkb.111.2022.05.29.20.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 May 2022 20:13:22 -0700 (PDT) From: Ihor Radchenko To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] Re: tangle option to not write a file with same contents? In-Reply-To: References: <583051.1635393898@apollo2.minshall.org> <12cd2bb0-584e-dcff-baca-1ed27d0281ff@gmail.com> <878rrcws6q.fsf@localhost> Date: Mon, 30 May 2022 11:14:02 +0800 Message-ID: <87r14bogp1.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::731; envelope-from=yantar92@gmail.com; helo=mail-qk1-x731.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1653880437; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=m8VWDdbCpPMP8BwOtyHkHZguY5Jb3z8ahKtb98pofyQ=; b=oI3eW8lOXWqzA/dHfEiTStPiTnNbWexZHeofZ2Vfen2/gKg2qS1Xo+Wzpf2SsCoExzz66Y 3SxQCQyvriQLK+Y+dcQd5PkC3ogish/+eIYZTN1/13GbRt3XgBO4ZlVLUYmT8JZ7Fi6sB2 IjeafWL2HieJ6dXWpZzvfBB3Sl5sH6tY93t/XP1921PKURyD6fGUkw7EZ0n4GkAvRPqlyT W0FMlTmYQoBPrpkaOdDfQfpS/dG/7ql+PJU/W3rz1r5dowJKTCCb7gFa702L2+h8paViok 2pohJJM3HotPQwNu3wRK3oqej6JJDbT0cFcG1gVjYk5qD5d+DnMooSLlRYl1/Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1653880437; a=rsa-sha256; cv=none; b=YeJ2rHvNFzAjhuTRYUXN7Mtg9fC6r0SKe2LL5ug4Td/KhYadkLhhtc7OQDeQ04TMjbfzH5 EYpuwDugtXHBaXW/qBKRM6WpYp631bQrAcqOAkl51AY91vxm7hKyJcscpKqfuSqBkwAXhn 1jtD1WhKB/siYCIsHWhQ5aQ+dCNlyZeetb7uIKJDIffHi1fFYPH5txoiSZ/r3jsxgFkfvI +7W2/vo6pmIacbDfHNf3ZZ0z2Vt4oooVDFsoJlZHIVg9wLN3CCgLVr9P340C06msRXlxM2 NlIuzLILrx+1ubIHFJec085Xjm6kUGUCGtrG2tG0M/CRPevER57aXes18SNx6A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nopPdDOS; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -7.33 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nopPdDOS; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 3AD7DB6C1 X-Spam-Score: -7.33 X-Migadu-Scanner: scn0.migadu.com X-TUID: KqlKQdzqV/0s I applied the discussed two patches onto main via 1525a5a64 and f6f26d4ce. The suggested amendments were incorporated. > I do not like (unless (when ...)) composition. If I remember correctly, > `when' should be used for side effects, so `and' may be more suitable > here. Otherwise it looks like what Greg suggested and should work faster > than first variant of this patch. I did not see any documentation saying that when is for side effects. However, or would do equivalent job there and also easier to read. So, I changed when to or as suggested. > I still had a hope that `org-babel-load-file' might be improved a bit by > using `byte-recompile-file' with 0 passed for ARG (previously I > incorrectly wrote FORCE). The goal is to avoid recompiling the tangled > .el file if it is not changed. Can you please open a new thread on this? People who did not keep track of this thread might not notice this suggestion. > I am still curious if it is reliable to compare file size from > `file-attributes' with (+ 1 (bufferpos-to-filepos (buffer-size))) for > tangle result prior to loading existing file. I am unsure due to > variations in encodings and newline formats, however it might further > improve performance then tangle result changes. In my testing, I did not notice any significant difference. Given than bufferpos-to-filepos can be tricky and sometimes return nil (see the docstring on QUALITY arg), I do not think that it is worth bothering. > I have noticed that `org-babel-tangle-file' may create empty org file if > it does not exist. From my point of view it is questionable behavior. Fixed. Now, set-file-times call is guarded by file-exists-p check. > Finally some comments on performance numbers. Ihor, your test simulates > iterative debugging. Tangle results were likely in disk caches. Another > case may give different numbers. Consider single pass after small > modification of the source .org file. For comparison existing files are > mostly should be loaded from disk. I did not mean disabling disk caches > completely. After tangling it may take some time till files are actually > written to disk. I am unsure if during repetitive benchmarking some > files may be replaced in caches without writing to disk at all, likely > timeout for dirty cache pages is small enough. My benchmark was for the best-case scenario for the proposed patch. Everything is tangled to files prior to running the benchmark. This way, none of the tangled files should change when calling org-babel-tangle and no disk caches should be involved. The benchmark without the patch, would write to disks. If your concern is correct and no actual disk writing happens due to disk caching, the benchmark time provided in the commit message should be a lower bound of the actual time. Then, we don't care. The existing benchmark already illustrates that the patch can reduce tangle time significantly. Best, Ihor