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 ms11 with LMTPS id APDQKrok9l/aNQAA0tVLHw (envelope-from ) for ; Wed, 06 Jan 2021 20:59:38 +0000 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 YCaKJrok9l/kIwAAbx9fmQ (envelope-from ) for ; Wed, 06 Jan 2021 20:59:38 +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 8309F9405D4 for ; Wed, 6 Jan 2021 20:59:37 +0000 (UTC) Received: from localhost ([::1]:45674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxFu4-0008K0-Fi for larch@yhetil.org; Wed, 06 Jan 2021 15:59:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxFtb-0008Hj-O6 for emacs-orgmode@gnu.org; Wed, 06 Jan 2021 15:59:07 -0500 Received: from mail-40130.protonmail.ch ([185.70.40.130]:23736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxFtZ-0008E6-9S for emacs-orgmode@gnu.org; Wed, 06 Jan 2021 15:59:07 -0500 Date: Wed, 06 Jan 2021 20:58:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1609966742; bh=sFCO/f4yP1ecV7uUgFv4RL2ktihUACHGeBoJoKJ7ne8=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=XrefTk1J/i6oEAHkDp5imqqdsCqTUysnenC/eM4GHe7RrWpq2kfJFFs1W/teSfFNs g5EET4OcAQzI3R2rOHvoaYcpZfTG7T95l6CLjEuIUf4ZsYo4V8pvknIu7hHbO3tYMd +iQmub/oRizN70KYv/KPc4WNSTwQ/EAcXNEO1emw= To: Kyle Meyer From: Emily Bourke Subject: Re: [PATCH] ox-publish.el: Speed up org-publish-cache-file-needs-publishing Message-ID: In-Reply-To: <87y2h9bctq.fsf@kyleam.com> References: <87y2h9bctq.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.70.40.130; envelope-from=undergroundquizscene@protonmail.com; helo=mail-40130.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Emily Bourke Cc: "emacs-orgmode@gnu.org" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -4.00 Authentication-Results: aspmx1.migadu.com; none X-Migadu-Queue-Id: 8309F9405D4 X-Spam-Score: -4.00 X-Migadu-Scanner: scn0.migadu.com X-TUID: FC+NJM+di7BO Thanks for the feedback! > Nothing jumps out to me. For large files that are already visited, I > suppose find-file-noselect returning an existing buffer can be faster, > so relevant factors would include how many Org files a project has, how > large they are, and how many of those are visited in the current > session. My guess is that using with-temp-buffer and > insert-file-contents would be a net gain, though that gain would be > narrowed some if the temporary buffer was put into org-mode rather than > kept in fundamental-mode (more below). I'll do some testing with some large org files and see how things compare = =E2=80=93 it might be worth switching to the buffer for the file if there i= s one already. > This reads to me like after-find-file is the hook itself. Perhaps > something like this would be clearer: "... avoids calling > after-find-file and running find-file-hook, ...". Ah yes, I had misunderstood =E2=80=93=C2=A0I'll rephrase it. > The goto-char call can be dropped now because insert-file-contents insert= s > after point. I follow, will remove. > Unlike the previous code, this doesn't activate org-mode in the buffer. > That gives a speedup. And I don't spot any code downstream that depends > on the major mode being org-mode, so it's probably safe, though perhaps > there's a subtle change in behavior here (e.g., related to syntax > table). > > If org-mode isn't called, the org-inhibit-startup binding above could be > dropped. Yeah, if you're worried about it I could try manually activating org mode i= n the temp buffer =E2=80=93 I'm not confident I could predict any problems = there might be from not activating it. > This introduces a regression. With the previous code, the > find-file-noselect call led to default-directory being set to the Org > file's directory, and then this expand-file call on the included file > was relative to that. With the new code, default-directory isn't > changed, so it points to a non-existing or incorrect file unless the > current default-directory and the Org file's happen to match. Ah, I hadn't noticed this =E2=80=93 I'll change it to set default-directory= manually.