From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
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 aNQKHWj+qmEOAAEAgWs5BA
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sat, 04 Dec 2021 06:36:40 +0100
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 gHiKGGj+qmHZDQAAbx9fmQ
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sat, 04 Dec 2021 05:36:40 +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 03DF62DE7C
	for <larch@yhetil.org>; Sat,  4 Dec 2021 06:36:40 +0100 (CET)
Received: from localhost ([::1]:36152 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	id 1mtNix-0005wn-3w
	for larch@yhetil.org; Sat, 04 Dec 2021 00:36:39 -0500
Received: from eggs.gnu.org ([209.51.188.92]:33580)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <yantar92@gmail.com>)
 id 1mtNiK-0005wd-Tq
 for emacs-orgmode@gnu.org; Sat, 04 Dec 2021 00:36:00 -0500
Received: from [2607:f8b0:4864:20::102b] (port=34435
 helo=mail-pj1-x102b.google.com)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <yantar92@gmail.com>)
 id 1mtNiJ-0002WG-Gu
 for emacs-orgmode@gnu.org; Sat, 04 Dec 2021 00:36:00 -0500
Received: by mail-pj1-x102b.google.com with SMTP id
 j5-20020a17090a318500b001a6c749e697so6381950pjb.1
 for <emacs-orgmode@gnu.org>; Fri, 03 Dec 2021 21:35:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:subject:date:message-id:mime-version;
 bh=h6iAgLlWDVwkAzJiO+3l+w6qA7uozRR1/QBdQu1sVow=;
 b=jg9wiVE5Co9hku/UocdYC7Xr4VZu/CctZ5HyFZDXx/ZqUks/ysEe8sUiTBpE1Q0W7g
 IdCZnHL4R8+/Pxk9z0UGxYd2ebSokQ4x8u9a59UFVDFwysTL+SllEO4dbA500pMCRQgV
 ScP+XSJmfEPqJAlj9yrrxseJDwzz+OgiEIr0Rwi5oTgLBH+6X4Nc8aZgq2JeC6Uauwuu
 dyYsGi3VXr8S4pkCXnui8E8fIQlTYJhWRSFW+PoNkgL3EfIZZIVty/hDOXTM9MnRylTb
 m73E5oSqkWQttsJKviAaqtmWEpysjGsfA2XsUCCuRelX214pZHxEPKXBnOSjd29jH1JS
 2dNw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version;
 bh=h6iAgLlWDVwkAzJiO+3l+w6qA7uozRR1/QBdQu1sVow=;
 b=YZ1Pk5c/fxvW6rSry1DEleS/dP4a9gwBigjaXiCoqqM0pePBMkBnXl4Oh+d+rohFlr
 xnR3ViPd+0PYIZdKvB3fV1d8JXfa3Dnq6yvkc9xefAAZ1Z3nsFgd+MND3yq3yXhlMVyT
 w7mLTQR0lG7TTh/c35ehVsNUfjfmYb6BEOQNuM0XJDz4RD92/b6EsfmOZQEOrzCM7w8g
 YOV3f2ILv9eTXtgR8+n+8q5RU0BN7iCLPw6B1gLt3wwF98EVYOvA70ZtsMslAp85tB5M
 pwj9nzrHIS7p5zLyeIETJ7K3K4y8r/2JvCb3YmllcbFM5N5YuxX1aGdc+1Ulg9GkW0cv
 0F5A==
X-Gm-Message-State: AOAM5329H+AdPWogoSV6Cycy+kt7BduqIFSpZ0OYMZRkhWaRQzQ82Ec5
 pI/SnewBOZ1/aO+gV7L4MkHAq765gLqR4QpR
X-Google-Smtp-Source: ABdhPJy3EXNdHsYCPkFZ+KBSAPZlC/ds0yLLrNqSWGQwo4VxjQavF1SEX97VxorMORajkb9UtfZ4aw==
X-Received: by 2002:a17:90b:4c44:: with SMTP id
 np4mr19937683pjb.195.1638596157424; 
 Fri, 03 Dec 2021 21:35:57 -0800 (PST)
Received: from localhost ([103.125.234.62])
 by smtp.gmail.com with ESMTPSA id g5sm6696650pjt.15.2021.12.03.21.35.56
 for <emacs-orgmode@gnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 03 Dec 2021 21:35:56 -0800 (PST)
From: Ihor Radchenko <yantar92@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [BUG] make test is extremely slow since b3cc2f793 [9.5.1
 (9.5.1-g984367 @ /home/yantar92/.emacs.d/straight/build/org/)]
Date: Sat, 04 Dec 2021 13:37:22 +0800
Message-ID: <877dclj5gt.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::102b
 (failed)
Received-SPF: pass client-ip=2607:f8b0:4864:20::102b;
 envelope-from=yantar92@gmail.com; helo=mail-pj1-x102b.google.com
X-Spam_score_int: -10
X-Spam_score: -1.1
X-Spam_bar: -
X-Spam_report: (-1.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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=no 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." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
Sender: "Emacs-orgmode" <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
X-Migadu-Flow: FLOW_IN
X-Migadu-Country: US
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1638596200;
	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:list-id:list-help:list-unsubscribe:
	 list-subscribe:list-post:dkim-signature;
	bh=h6iAgLlWDVwkAzJiO+3l+w6qA7uozRR1/QBdQu1sVow=;
	b=BS39+BRdCYDQRnNQH0JDXf+bXiCGyIJzemhK1pIi9J+SBgffmGwLQgvNwSiyLklSTH4b1R
	3CDIDeRT0bT8mLLXx95KRvsxgekRWOZLbsa7XCRRw+BLvne7nd2jrasLGn4EBz3UmIOaDR
	2F59wPu1zlDYd0zbdSO1Rzvqxbzx5u7BrTIYVK9yl3Dld48msze1Ugv5k6MPuVRY5wnH83
	A98FayXNdC8dGQFgTIzEoueUSfhVl+iZmAGUr8nI0R3dFHyOjLRH5rRr8AzBXRrsAZUr+s
	fzxu5CnaswYixs517FJ/DCE4Jx9g8DAxtRZMWiydFP7tlJK8UTbHoLvW/qXu2w==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1638596200; a=rsa-sha256; cv=none;
	b=gC/Y147XtXECJUTZTwChS1pyj4jHiSnDmMjLrWeNneHzJiVeF6CoSrcDRgQxWnxnN285eX
	6H6Kri1PxgBZJiRI1G6egha+wBVHbr2pe8hYkvxYfl6iPjfhIHPP6GS/deo/UeBKkQdYh0
	mkl4gUmy5IutCoJlFQLoXwSOd21ghJyEE7fRthrvX6TjlpSySXPyGLECxUBwDXMu0qCYq7
	+exW64hH39qoynWbX0/sXhMRz6ZPsTTNdrDtPhV2ljF0pMmYkNK1W/N+wnpiu3pinCzD8l
	vxkG5XL9NS12txCChK/aCxhWCkYd23oDOw0UHCXo7igGeK0kvjT9p9ATp3O+LA==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=gmail.com header.s=20210112 header.b=jg9wiVE5;
	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: -3.63
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=gmail.com header.s=20210112 header.b=jg9wiVE5;
	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: 03DF62DE7C
X-Spam-Score: -3.63
X-Migadu-Scanner: scn0.migadu.com
X-TUID: xDK6e0/hiEU+

Hi,

I noticed that make test became extremely slow recently.
The first bottleneck can be seen in

make BTEST_RE="^test-org-cite/adjust-note" test

passed  1/1  test-org-cite/adjust-note (12.321278 sec)

The test takes 12sec!
Moreover, subsequent tests (even not related to org-cite) become slower,
presumably because we overuse Emacs memory.

I am not using org-cite much myself, but I imagine that ordinary users
may also suffer from a similar performance issues after multiple
exports.

The profiler report shows that org-cite-get-processor may be the cause:

        5794  91%                - ert-run-test
        5794  91%                 - ert--run-test-internal
        5794  91%                  - #<lambda 0x5c69d99ea013bd4>
        4813  75%                   - let
        4813  75%                    - let*
        4813  75%                     - condition-case
        4813  75%                      - let
        4813  75%                       - list
        4813  75%                        - cons
        4813  75%                         - mapcar
         516   8%                          - #<lambda -0xebdf3f4ac8552e7>
         516   8%                           + test-org-cite--export-with-rule
         497   7%                          - #<lambda -0xebde86ea74e52e7>
         497   7%                           + test-org-cite--export-with-rule
         417   6%                          - #<lambda -0xebdf3f4b1fe52e7>
         417   6%                           + test-org-cite--export-with-rule
         398   6%                          - #<lambda -0xebdfc57f09452e7>
         398   6%                           + test-org-cite--export-with-rule
         397   6%                          - #<lambda -0xebde86e9e4b52e7>
         397   6%                           + test-org-cite--export-with-rule
         393   6%                          - #<lambda -0xebdfc57ded652e7>
         393   6%                           + test-org-cite--export-with-rule
         389   6%                          - #<lambda -0xebdce06d12652e7>
         389   6%                           + test-org-cite--export-with-rule
         377   5%                          - #<lambda -0xebde86e96a852e7>
         377   5%                           + test-org-cite--export-with-rule
         377   5%                          - #<lambda -0xebde86e989552e7>
         377   5%                           + test-org-cite--export-with-rule
         368   5%                          - #<lambda -0xebdfc57f3d952e7>
         368   5%                           + test-org-cite--export-with-rule
         347   5%                          - #<lambda -0xebdce06cb7d52e7>
         347   5%                           + test-org-cite--export-with-rule
         337   5%                          - #<lambda -0xebdfc57f51352e7>
         337   5%                           + test-org-cite--export-with-rule
         981  15%                   - let*
         981  15%                    - condition-case
         981  15%                     - let
         981  15%                      - list
         981  15%                       - test-org-cite--export-with-rule
         981  15%                        - let
         981  15%                         - let
         981  15%                          - save-current-buffer
         981  15%                           - unwind-protect
         981  15%                            - progn
         942  14%                             - let
         942  14%                              - let
         942  14%                               - org-trim
         942  14%                                - org-export-as
         398   6%                                 - org-cite-store-export-processor
         224   3%                                  - org-cite-processor-has-capability-p
         224   3%                                     org-cite-get-processor
         174   2%                                    org-cite-get-processor
         232   3%                                 - org-cite-finalize-export
         232   3%                                    org-cite-get-processor
         214   3%                                 - org-cite-process-citations
         214   3%                                  - org-cite-export-citation
         214   3%                                     org-cite-get-processor
          30   0%                                 + org-export-copy-buffer
          29   0%                                 + org-babel-exp-process-buffer
          20   0%                                 + run-hook-with-args
          10   0%                                   org-set-regexps-and-options
           9   0%                                 + org-export-data
          20   0%                             + org-mode
          19   0%                             + font-lock-ensure
          62   0%                + #<compiled -0x15985ab8cfaa100a>
          20   0%                + #<compiled 0x1ebe2226a11f1053>

Best,
Ihor