From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id UA0KNEaUNWKgWwEAgWs5BA (envelope-from ) for ; Sat, 19 Mar 2022 09:28:54 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 4O+3LEaUNWJkVQEAG6o9tA (envelope-from ) for ; Sat, 19 Mar 2022 09:28:54 +0100 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 3E6D888AD for ; Sat, 19 Mar 2022 09:28:54 +0100 (CET) Received: from localhost ([::1]:50306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nVUSC-0008Uz-Ur for larch@yhetil.org; Sat, 19 Mar 2022 04:28:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVURl-0008TX-Bm for emacs-orgmode@gnu.org; Sat, 19 Mar 2022 04:28:26 -0400 Received: from [2607:f8b0:4864:20::434] (port=46994 helo=mail-pf1-x434.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nVURj-00070v-SF for emacs-orgmode@gnu.org; Sat, 19 Mar 2022 04:28:25 -0400 Received: by mail-pf1-x434.google.com with SMTP id s11so11406028pfu.13 for ; Sat, 19 Mar 2022 01:28: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:content-transfer-encoding; bh=Fh+loFdDh0ElbXv5iMJBJYznkX0LRfQ1sFNClX82m0Q=; b=CIwGD1/bW1KioMMfl095h/B/o6xij5/XwQWgliZm/UbPvbjs6YY6CCcyBGM5Or4z9p hYjGp/WzSWd9woZ5SRcgtdro2BxhdAsYO9U2u3z+6JsvknCcYx2rV/3q+FTdv6xG8Q/1 KR04IH/Movs9Urq773sB9mjqyhLyaAh+S3x3GC7zvsrYRh/2WPHbtBNiqTCMBdIKmbgr pnOh9EaNU1j9RdQ5atHfzv7GbiBzw8cJ5DYyyWGcQNNN4ZgLWj7X9mRG7N3504eohMUF +ANDz3NCdJShJxMMLdeRo+xUJGzjgDAGW9CTQ5KKKL5MjShlLTnFC0ONJqReu7ZKJdjX ZbdA== 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:content-transfer-encoding; bh=Fh+loFdDh0ElbXv5iMJBJYznkX0LRfQ1sFNClX82m0Q=; b=NZUwO1wRgNiVz0OuBRxA6lUtVDiX767Iztm3vxhWrQ+rtcQtg26/nwt9mS5y5wM6Qc Y5kjL2cpRMLkzogAEUTrfzN5wdoZe/tVCuwi5cqOjXK8xWdMzOl9SIPHT5AFMEn/l/nN zLr4SCVLj/sMC9MNdBL0yJdkNoX4FXbaUeYAV+eu7SZCbgOqoM926WySUmM4wv4a/G0A 4k7lUzAYhtwzEN85yrM1Rro2sqYutQNnS2XONchX/dWuVlMA0add9IkpDybcuD4KyWR7 55yJNU8KZ2zwZxlGFXbzWQl4S+0ObCycbeTQ53Ev9A7beawNuGPqsp+GU9CIY7aGWAUz +wSA== X-Gm-Message-State: AOAM531nd5HWZnzDEpjEBKsh1n8C4OjWMMb4iZE4cgj4Up/tFE2jQXJB bvNq+KMLv5Ua/kcYS3vTrCA= X-Google-Smtp-Source: ABdhPJyPhtKTDyAbMvgt5Y9BXRoXWEvU77vSFNmekIo+heynL/oupzuz46EDKaviflAmL3owjPV+zQ== X-Received: by 2002:a63:df0d:0:b0:373:401:6818 with SMTP id u13-20020a63df0d000000b0037304016818mr10730849pgg.34.1647678502233; Sat, 19 Mar 2022 01:28:22 -0700 (PDT) Received: from localhost ([45.128.72.3]) by smtp.gmail.com with ESMTPSA id v6-20020a056a00148600b004f9f9b9092fsm12473198pfu.113.2022.03.19.01.28.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Mar 2022 01:28:21 -0700 (PDT) From: Ihor Radchenko To: Jamie Matthews Subject: Re: [BUG] org-cite: 10 second hang opening a ~4k org file with 10MB bibtex library [9.5.2 (9.5.2-g91681f @ /home/jdm204/.config/emacs/straight/build/org/)] In-Reply-To: References: Date: Sat, 19 Mar 2022 16:28:50 +0800 Message-ID: <87pmmifirh.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::434 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=yantar92@gmail.com; helo=mail-pf1-x434.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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-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=1647678534; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=Fh+loFdDh0ElbXv5iMJBJYznkX0LRfQ1sFNClX82m0Q=; b=rlrUxfdEcPE7536JGkC9DlDPy9K4vHElfAOnnqWiz9A1gg5+pxNSViU90qr5yEiMMb/Mr1 VNg2hRC1ZuI3IVlSBA4GP+47DITy4pb2suxJrvrJTbi4A7pUQjigL2woh8GZmwNoIvo0D3 NuBpkxFX6RUCyXE4CU6y2siNQbqu0iHlhJID7hiYnVT1hLn9giE0kYyqYAzWKPfM1U72+i A+IL7Nn4CG2hdA13kndgGrjMdI+RNMp1Eu1cfo8I7VF3hu/zamL51Uf0dloouQf5zVNw/o Hxu4Knnyib15i7eGzr52th7BuwSyoKAWvn8wYN7HJXvjdkHwGXmlZMjTKKokvg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1647678534; a=rsa-sha256; cv=none; b=uS9eZJZDb6wRwBweymmXWKpebY5sjo9TOY8r4O2YLWZQZgxV2UZyXIdIJejq8/rHZ/x1jk KZH2rs0e83X4SaNXdTM82QiGkzcmcwIh7mzekJ4OCQ7LydMLrHwwveDEvQZtsZbIlOAnrA pdRjtn6yei6zq4GbDFbTH094ltT7TReVEWrVhHHLhseWGnFq1KQZx1OVGeU8IVZuSGZYPp JLrTO/j/VZbKQADQniysfgxxTDjQnJkueEOkxQsjJCz1/61m8rpG64jWtQa0epyvulfiKE QIwSJvTSFUU3HfZOzrY5JaAG2jBFaOL989oTWV+EeBJjqO5rEwcSz4c70i8+Hw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="CIwGD1/b"; 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.64 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="CIwGD1/b"; 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: 3E6D888AD X-Spam-Score: -3.64 X-Migadu-Scanner: scn0.migadu.com X-TUID: XQkv4mN8lM2A Jamie Matthews writes: > # Issue > Starting emacs with emacs -Q=E2=80=8B, then navigating to a minimal examp= le org file with C-x C-f=E2=80=8B yields a ~10 second hang on an 8-core/16G= B RAM machine with nothing else running. Also, scrolling commands like C-v= =E2=80=8B are often laggy after the initial hang. > > The minimal org file begins: > """ > #+bibliography: ~/cloud/library/lib.bib > > [cite:@tillyPrimaryAnaplasticLargeCell1997] > """ > with another 80 citations afterwards, one-by-line, but nothing else. As m= entioned in the title, the lib.bib file is ~10MB - if I swap this out for a= non-existent or tiny bibtex file the problem goes away, and the in-buffer = citations are rendered in a red face. Clearly from this and the below profi= le the issue is something to do with checking etc the citations for fontifi= cation purposes. > > # profile > > ## cpu > 1,542,542,267 99% - org-cite-basic-activate > 787,037,416 50% - org-cite-basic--get-entry > 4,065,194 0% + org-cite-basic--parse-bibliography > 754,769,872 48% - org-cite-basic--all-keys Could you try the following: 1. Execute the following code: (require 'elp) (elp-restore-all) (elp-instrument-function #'org-cite-basic--get-entry) (elp-instrument-function #'org-cite-basic-activate) (elp-instrument-function #'org-cite-basic--parse-bibliography) (elp-instrument-function #'org-cite-basic--all-keys) 2. Open your org file where Emacs hangs 3. Run M-x elp-results 4. Report the ELP buffer contents here Best, Ihor