From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id KOCKA4CWk2RviQAASxT56A (envelope-from ) for ; Thu, 22 Jun 2023 02:32:00 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id EI+tA4CWk2SUhgEA9RJhRA (envelope-from ) for ; Thu, 22 Jun 2023 02:32:00 +0200 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 99A1512DF for ; Thu, 22 Jun 2023 02:31:59 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC8E1-0005b5-Tj; Wed, 21 Jun 2023 20:31:01 -0400 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 1qC8E0-0005aw-Qj for emacs-orgmode@gnu.org; Wed, 21 Jun 2023 20:31:00 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qC8Dz-0000Ot-4T for emacs-orgmode@gnu.org; Wed, 21 Jun 2023 20:31:00 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1b55bc0c907so34869565ad.0 for ; Wed, 21 Jun 2023 17:30:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687393856; x=1689985856; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=9yoyLlmOGWZvG9WpiZL+53LXcvDkgyoAO58IGAU7xHI=; b=dDfNDfbZxtVTqsYb+RfWCN55OqYvTJiZdFMXaptOkedYo8Ss1TAZOJhTYrt1jBhGzY EjucRuLVe6Gzij7gINZpPnVT0yTAZwOgOXz1u/jVEA305+iuOHWS5PI5vRuc5LbfNOh6 bxd8h5D2MzPjWLtX6gXcGOgqTspA8Moz7rEEcvR2p0zrg+igrgWxsv1wY8dWtdT5NOfG eCfycSwYcnu8Nyr74u/Vca+XuNFSvkJq510XeDh1YagjHFPz/u2r1ttKnAaj1lv3cwVQ AH+2HD86ugy4okAqLLP4qxt805IEWXOwkSL0L1xqBeld7pFCq596BnjZin1RaMoUkt84 6+uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687393856; x=1689985856; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=9yoyLlmOGWZvG9WpiZL+53LXcvDkgyoAO58IGAU7xHI=; b=OSypM3msNCQe67ppwiuI0Ov1I8C1ohsGKohiMGXxvmsngO4VzzQz+UlHh6eWgza2IJ pKeN8WQL3ryJ/lbnd3ItehqosrquDD3cMDbobTussosPlMaAHn9qa4bEIJoxzjinIDBD HJwtembqPCTQs5xbDqZk06shjcNUW5q+aaKfF3afp7LhUkub4gMfHG5QgpG4S2Lxqa2o 1g24FtKoqjSA3qJMEbovBp52/4Nc7o2gkT1ibgRu8UcE0altuUFg4EO3Qsd+/jUqnglB jcVNdhYeUCChwu3B0xPIQuzoMfPB4zm6HzeElHXr/kIioRQeYIay6lQe7gGsoScNrXCX 1I5g== X-Gm-Message-State: AC+VfDyN2XaptmfSa4DbGbl6ua2xVK1F2/irvlkp755Cvwv/xYYgrvxS U65JeLKpFZow5K8WE0tx33hxHD3tXycZHw== X-Google-Smtp-Source: ACHHUZ6SEaY+VEF4XGfXkOTbWKG60vwWABZHg4Rqg34IOlUwgWqytwUN14ft8EABoDQ0ngcIxSQ07Q== X-Received: by 2002:a17:902:c40c:b0:1b5:3aed:b078 with SMTP id k12-20020a170902c40c00b001b53aedb078mr21561368plk.53.1687393855872; Wed, 21 Jun 2023 17:30:55 -0700 (PDT) Received: from localhost ([220.253.243.134]) by smtp.gmail.com with ESMTPSA id n21-20020a170902969500b001b016313b1esm4088355plp.82.2023.06.21.17.30.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 17:30:55 -0700 (PDT) From: =?utf-8?Q?Sebastian_W=C3=A5linder?= To: emacs-orgmode@gnu.org Subject: org-fold style text-properties slowdown Date: Thu, 22 Jun 2023 10:30:51 +1000 Message-ID: <87pm5oe3t0.fsf@nixos.mail-host-address-is-not-set> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=s.walinder@gmail.com; helo=mail-pl1-x633.google.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1687393919; 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=9yoyLlmOGWZvG9WpiZL+53LXcvDkgyoAO58IGAU7xHI=; b=ZsUwQgj/6ON/p4IhVISgoju7f+frTnTrN8aLEcG/odA58zyozBhyoUd8SfQu52BKy6KaSn hvs5wx2xqj+vJG5U5WmhVE261nIwvMvf2R6x9fZQusBAR/B7+/oOxH/MoGLGTbBRjgSKnv EvwLzeBJ7Yu8HXC2Ha5rzcpC73MvNvv3aUTESTNJqd/VNlwxN/ojx7cIWh9FBzOrUQvv5o X0yLGpg7o94aXr50kYNwqn8SxGO0Su5We+OzmXpZWq2ZsgKbaqkhYC0/bte3IXXGEGwYb7 A5pkigGAyWG2hhrN2TChb+HXyYL4rl0o84F8tHt0TCbsHAiERRRAQj5DacpzHg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=dDfNDfbZ; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1687393919; a=rsa-sha256; cv=none; b=nSUbhX73To9Gxzhp9wmgVV/HUy4TwsfbvIJ7kVzF4VC9Wht4jFgYVD4RXDQBpvNoULyIpq bWLl9TvRIwfecatpVAp83Puadu1Dg+Obn8s/3UJ3R1Wqj4pJVO4rLIgCUhcIfrnuZEv+AC A+iXjjwbD5+Y+OC21sBDWOyDvfD9vWbH7UsBzkuSpoaTJep+CDIU6uJ//s1vYkkcby0te/ L5CTVb2ZqKIKlj5O+P4Y7M7JTc1qxrlnu5443YT9koPGHhLqlQnbpPD2szlzCvaJR0S6HF qjD4g+fJx+aOv//rwUx1u7Rc1JXOzZin13EpEepgf8A+yiHImusswpTfKsMCYA== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -4.91 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=dDfNDfbZ; 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: 99A1512DF X-Spam-Score: -4.91 X-TUID: SuYUYwXoh/zX Hello! I write regularly in a massive org file ~160 000 lines, and experience progressive slowdowns as the buffer remains open when I have the setting `(setq org-fold-core-style 'text-properties)`. When the file is first opened, all operations are very fast. But as I keep using, it keeps slowing down and eventually slows to a crawl where typing a single character takes several seconds. However, after closing the buffer and opening the file up again, the speed returns to normal. With `(setq org-fold-core-style 'overlays)` in my `early-init.el`, I have no slowdown issue related to org-fold over time. Running the CPU profiler while typing a few characters in the buffer yields me this report: ``` 17969 99% - command-execute 17969 99% - funcall-interactively 17956 99% - org-self-insert-command 17940 99% - org-fold-core--fix-folded-region 178 0% - org-fold-core-next-folding-state-change 177 0% # 42 0% - org-fold-core-get-region-at-point 1 0% org-fold-core--property-symbol-get-create 21 0% - org-fold--reveal-outline-maybe 18 0% - org-fold--reveal-headline-at-point 16 0% - org-end-of-subtree 9 0% - org-back-to-heading-or-point-min 8 0% - org-before-first-heading-p 8 0% org-element-at-point 1 0% org-back-to-heading 6 0% org-element-at-point 2 0% - rx-to-string 2 0% - rx--translate 2 0% - rx--translate-form 1 0% - rx--translate-or 1 0% mapcan 1 0% - org-fold-core-get-folding-spec 1 0% org-fold-core--property-symbol-get-create 1 0% - org-fold-core-region-folded-p 1 0% - org-fold-core-get-folding-spec 1 0% org-fold-core-get-folding-spec-from-alias 1 0% # 1 0% - # 1 0% let 1 0% - org-element--cache-after-change 1 0% - org-element--cache-submit-request 1 0% org-element--cache-sync 3 0% - my/system-hydra/profiler-stop-and-exit 3 0% - hydra--call-interactively-remap-maybe 3 0% funcall-interactively 3 0% - evil-normal-state 1 0% - evil-change-state 1 0% evil-insert-state 3 0% - my/system-hydra/profiler-report-and-exit 2 0% - hydra--call-interactively-remap-maybe 2 0% funcall-interactively 1 0% - hydra-keyboard-quit 1 0% - # 1 0% - message 1 0% - apply 1 0% mini-modeline--reroute-msg 1 0% - evil-previous-line 1 0% - evil-line-move 1 0% line-move 1 0% - my/system-hydra/body 1 0% - my/hydra-pre-cursor 1 0% evil-set-cursor-color ``` The memory profiler reports nothing significant. It appears `org-fold-core--fix-folded-region` is what's taking all the cycles. What's the best way for me to proceed debugging this? Setup: `GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars)` `Org mode version 9.6.6 (release_9.6.6 @ /nix/store/q8adc2srnbipkahbwffwg006d09yk02g-emacs-git-20230618.0/share/emacs/30.0.50/lisp/org/)` Thanks! Sebastian