From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#67536: 29.1; Calc mode's math-read-preprocess-string conses unnecessarily Date: Thu, 30 Nov 2023 09:00:18 +0200 Message-ID: <83h6l367zx.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22741"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67536@debbugs.gnu.org To: Raffael Stocker Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 30 08:01:24 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1r8b36-0005nJ-1C for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 30 Nov 2023 08:01:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r8b2h-0002Jm-AX; Thu, 30 Nov 2023 02:00:59 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r8b2e-0002JW-3t for bug-gnu-emacs@gnu.org; Thu, 30 Nov 2023 02:00:56 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r8b2c-0007Ik-Ul for bug-gnu-emacs@gnu.org; Thu, 30 Nov 2023 02:00:55 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r8b2k-0000Jy-IB for bug-gnu-emacs@gnu.org; Thu, 30 Nov 2023 02:01:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 30 Nov 2023 07:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67536 X-GNU-PR-Package: emacs Original-Received: via spool by 67536-submit@debbugs.gnu.org id=B67536.17013276561214 (code B ref 67536); Thu, 30 Nov 2023 07:01:02 +0000 Original-Received: (at 67536) by debbugs.gnu.org; 30 Nov 2023 07:00:56 +0000 Original-Received: from localhost ([127.0.0.1]:52090 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r8b2d-0000JV-S6 for submit@debbugs.gnu.org; Thu, 30 Nov 2023 02:00:56 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56142) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r8b2b-0000JI-R2 for 67536@debbugs.gnu.org; Thu, 30 Nov 2023 02:00:54 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r8b2G-0007F5-JD; Thu, 30 Nov 2023 02:00:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=1Zi3JJFWqch06b+K3eqElGaO0GnL8HtAvhDG5WyUHQ8=; b=pII36Ustg1GC vhRU67pS4JB0nOYGZdaBnPW/P8g1TNTdCDlyMHOp1MFcWPadVgSGZanEY+thMPNKumcxqMBCtbjsT xz8EjzIuYs+aXHAvmg2f4/N3UrAQh5g3HgGlce/qSEwgWULV4bRm78nTVtRhGT95lN4qINcagQOgj BtUOOLZ91vDoyC7pVp74FzSlmm4xuY9kvzaz9YKVwFs3C1xRya0fyXpwOIkIRW4yCa1qub7SdNuJQ CIxBU72Y4RcGQluX3jhLKu2cqtd+pskFpdxpBPLnd9Fi/rJc194dEZBSeHLzresptenNKzO27jP8W yCSuhfdy/0u7aO8vNR8OQw==; In-Reply-To: (message from Raffael Stocker on Wed, 29 Nov 2023 22:29:38 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:275272 Archived-At: > From: Raffael Stocker > Date: Wed, 29 Nov 2023 22:29:38 +0100 > > > Org table re-calculation is very slow, partly due to > math-read-preprocess-string of calc mode consing unnecessarily. For > example, in one (large) table, I get the following memory usage from the > profiler: > > ... > 60,252,646 96% - org-ctrl-c-ctrl-c > 60,248,166 96% - org-table-calc-current-TBLFM > 60,216,431 96% - funcall-interactively > 60,205,119 96% - org-table-recalculate > 49,094,651 78% - org-table-eval-formula > 32,624,631 52% - calc-eval > 32,624,631 52% - calc-do-calc-eval > 32,620,487 52% - calc-do-calc-eval > 32,611,151 52% - math-read-exprs > 29,388,838 47% + math-read-preprocess-string > 2,343,257 3% + math-read-expr-list This is not memory usage, this is CPU usage measured by using memory-allocation functions as triggers to probe for the function that is being executed. So its evidence about consing and GC pressure is indirect at best. Can you instead look at the values of gcs-done and gc-elapsed before and after running the offending code, and show the delta of each one of them, with and without your proposed changes? Then we will see a much more direct evidence about the number of GC cycles and the time spent in GC, and could make the decision about how to improve the situation. Thanks.