From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: Which is faster: narrow-to-region or delete-region? Date: Wed, 22 Sep 2021 09:00:54 +0200 Message-ID: References: <83wnn9w43b.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21573"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 22 09:03:36 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mSwI4-0005Tl-Fw for ged-emacs-devel@m.gmane-mx.org; Wed, 22 Sep 2021 09:03:36 +0200 Original-Received: from localhost ([::1]:40606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSwI2-0003gO-2U for ged-emacs-devel@m.gmane-mx.org; Wed, 22 Sep 2021 03:03:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSwFZ-0001CT-Nk for emacs-devel@gnu.org; Wed, 22 Sep 2021 03:01:01 -0400 Original-Received: from mail-db8eur05olkn2029.outbound.protection.outlook.com ([40.92.89.29]:26305 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSwFX-0005Ul-BL; Wed, 22 Sep 2021 03:01:01 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QFSe4ACSt0v653Frj0fVsqlEPP9+O0TiknSn4jA/ZeCJH+0BN5jf59PMf9D6eSnoQbNhwVYixohjKWZTtJNFmMSHrcUlupn+Z6H3xq4GrsB3em2Eg7r3O0flEI3xQfSXRgNu1qZOk7FxBGtwKDj6juWbBV6qQke+YHSHBp+cVpArDvOQsZShrCR6Rt3zWITOvL+BZQW9ROpbYUcEs1RwwqJ6+oNcH5+PMJvJiKMMeHG4Vn1hDyJr6+BfbqzPvrkGipcJv48e3gLJNScILwA431lM6sGHLcmBduSM3WDIaseVheeBy/psFJWrCPu1bYYc/ONX2WlN81QFx2tBlhtYDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=YTfSTEYpfiHcZ3Q4dg+iXIMZ7ElcgzeBvL4k2rfmQAk=; b=TagmjxHebgxvKaQ3vQMHnC7o54VCWwjTusUPoFIfR/nafQOZLcIE84kvPvfX0/u6Cuz6FgRCi7AAJyT0JlbaDgcwYfaRMsgBdnIgzhvt+cyLy2idBDMbOjcjf1A+lRfg+VGPGMrcQh4Z40ZJTyFW6ak7hV6Pwvv9+04ulYoOkS3YMix8mDrigO0JmJNzn222HlKrmjbidlF3AW8f2egpKFTyDrLKV58YG1CmKhuSPbMVSV3z27LYZtdlsRc6kqbkd20+F9vqbfyPe/Ri5XOu4dkRpWwhfMqYJ0CWduFf6fGIG/IY6zUvPQwSmZYoKAWLEop+Z9D9s8N+waMMrRlP3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YTfSTEYpfiHcZ3Q4dg+iXIMZ7ElcgzeBvL4k2rfmQAk=; b=rnqNSVHidu1KBzlN12yWY8Vt4h7N/u7scU6pww1aCDYvQE5JDTumrl9gy872L3GMlj5x8fYMUXrHFAREHJgouHJgmX1wYc1FUrut+73BjX6TODrLJ7cmocdAoEDiSv1EHq0J+dd3mK82Xf4gS71jGBhKXcbDQOTPRcc6QaBLk8LMCDV7Dy4eHR2Rn7ClNLIaPKi3zRF1YL65QVl9pwwS74ozJ1EzSRsMZjFJJ64pVe2TIU7tTRMxnAN5GNII9gsMsRo8zZKzYrQp3JOjX8XJWhmVURxQOEvrNvTi/Q3W2kcrJjMYPpXzewiNWW5rqgD7T3R2lwHOLjd9SR+pmZvMMQ== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM9PR09MB4929.eurprd09.prod.outlook.com (2603:10a6:20b:300::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14; Wed, 22 Sep 2021 07:00:56 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c55c:ece5:bed2:a9dc]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c55c:ece5:bed2:a9dc%9]) with mapi id 15.20.4544.013; Wed, 22 Sep 2021 07:00:56 +0000 In-Reply-To: <83wnn9w43b.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 22 Sep 2021 08:51:04 +0300") X-TMN: [TEID8F4iyVFJuhC7+DkL2oLdzkiF+BNS] X-ClientProxiedBy: HE1P191CA0021.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::31) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <878rzp6qmx.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by HE1P191CA0021.EURP191.PROD.OUTLOOK.COM (2603:10a6:3:cf::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Wed, 22 Sep 2021 07:00:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: efc9e331-ef41-4223-b40c-08d97d96b988 X-MS-TrafficTypeDiagnostic: AM9PR09MB4929: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TtrL8zJ4bWvld60Lg8SmK8ystZpr/h7Fkg9y5KQr1axVw+tZRbBd6Tr1spjGs2RhNp7Jitzg1f0mmdSGDXe09ATZB7c26VZiLjEWxAhlQZ6duv0Y9v8pqvYaLfhCXM/BaPcznq4wTj/Z7+zfhcJB2fba87PVx9Q9aABpH17kgGf+zePdwhCpILR30fYPF8YXIQHl6qkhL1P8iSVAp1PG3EtVHJ4+eQxAV2EUTiHrXmTeCew4+PT9LLgUld6S2VOl8DtaZwEheiD1f6vtGrrzHcYR27gj+Tpuh4tVc59WuWD8uEOlP3kfztYZ6EKn1m/9HcNSEybuEPe8QhQk6u92978E6p2fMH3JJw3wmw8ykB4avOo48q76Alr9Fzq++OeY3K6h2OQKl36K4G7ljZ8Mk5ou8Wb4wxZC16DwiR867pEE0F1VPo772kqHqT0eP8g5 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IJVyZoQdYrz2tpJVzJ0BYrLDIK8UKIslR0u3O2GaYQse2qH+HEANGOHOt5Cy1tQ4OkX2wEeb6IbaXsEwyvx+W1EO1ntGGXttc/rR0aGwRCbBTa/YSaMI/bfJFtDGO+Q7YdUHVd8EjHegPGZk0znZLA== X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: efc9e331-ef41-4223-b40c-08d97d96b988 X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2021 07:00:56.5257 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR09MB4929 Received-SPF: pass client-ip=40.92.89.29; envelope-from=arthur.miller@live.com; helo=EUR05-DB8-obe.outbound.protection.outlook.com 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:275294 Archived-At: Eli Zaretskii writes: >> From: Arthur Miller >> Date: Tue, 21 Sep 2021 22:10:09 +0200 >> >> >> I have a DEFUN in the middle of a temporary buffer; which is faster to use to >> eliminate the rest of the code from the calculations for font lock: >> >> (narrow-to-region defun-begin defun-end) >> >> or >> >> (delete-region (point-min) defun-begin) + >> (delete-region defun-end (point-max)) > > The narrow-to-region method must be much faster, since it only sets a > bunch of variables and does little else. Thought so when saw the code, but wasn't sure. > bunch of variables and does little else. Moreover, it cannot trigger > GC, whereas delete-region method very well can. That too, wasn't even thinking about that. I am not so familiar how GC works with code in C. >> I have tried both and notice no differences. > > Maybe in a very small buffer. I was just tested in help buffers with that patch I made. But it is interactive so it is hard to see the difference; I haven't benchmarked. Thank you. That was educative. And helpful.