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 ms0.migadu.com with LMTPS id mCvzDN4QFGJzOQEAgWs5BA (envelope-from ) for ; Mon, 21 Feb 2022 23:23:26 +0100 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 6Es1Ct4QFGKUowAA9RJhRA (envelope-from ) for ; Mon, 21 Feb 2022 23:23:26 +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 A9D8513C04 for ; Mon, 21 Feb 2022 23:23:25 +0100 (CET) Received: from localhost ([::1]:33052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nMH5Y-0005V4-Qn for larch@yhetil.org; Mon, 21 Feb 2022 17:23:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMH4w-0005Pp-IP for emacs-orgmode@gnu.org; Mon, 21 Feb 2022 17:22:46 -0500 Received: from [2a00:1450:4864:20::130] (port=39554 helo=mail-lf1-x130.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nMH4u-0006f8-Cq for emacs-orgmode@gnu.org; Mon, 21 Feb 2022 17:22:46 -0500 Received: by mail-lf1-x130.google.com with SMTP id j7so21155115lfu.6 for ; Mon, 21 Feb 2022 14:22:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=76QGTeazju2VNE47WYEsU3D8KjkXKCg8afTIadkvNPg=; b=oJHOz/usQ+74rqdo7SSbLAE3Jg3qMDdeuG5cMi+xnqcOSzLTriun2wgPn5eLBKsj7C gz+F3cU1Q2T00cSMRRv8NVj4vcZUcxA6VvXh9VrRc5xR53Likn1Hr8u0RJyIM6fV9fBE bnTMn4xrat6UfrXy0oPGd+PZIg9VbCD3pQow0njtT3QAIgnofJdEGszEt4TNuszJhW+R AQzegOxcnePp2xACBlSk99Gz3vigzr5RppQfC7xwBc+xriW6nHlpEJhCq9jw3uib9Cxc HCWQWr3/bh9MHgVPzx73wURepTRsthX1O4ZvQG8ExxMY7bZIK+wh1f243RLMV4C0bIQq oFYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=76QGTeazju2VNE47WYEsU3D8KjkXKCg8afTIadkvNPg=; b=kCizWqo8eRnNyy7cCi1iwpELno4SzsZ6u80L+Ly0hriganaD5F1BaK/kGDOmsIf5zv Tf6GebA+0crc5T9CuF+v3hTS2FDHfakxY+Osua7o9ihOvnIQ261zUYGF28P5aMjVFxZe nQH2WI9EKW/YdeT5rD+pZp3AJ54Vrb8xGTZbnWa+ZUJq7VlHjFF0pHpCN4+a9lnSrFjc sC06XFOmA5fDdWVG3u6IPmux64CNBoZp7hRX4p3kP8fvUZbOBZeXQ3e3+TmdLBXOQ84R 7riojWm8JJn4CV0/K2cQLJPRcHUkwHw+eF/wdCpLp3xG5FkdFvzE0OAEd4JfYj3R//NA ZKXg== X-Gm-Message-State: AOAM531HTHIUIYXFtj5fYw9D3qGjJ3OS+5bddXrWMIsr+kaeXQ25fTQ6 1K+DnmZnhdYaDT2qNWmpaBcQ3Xdg9KoNfvCDhFM= X-Google-Smtp-Source: ABdhPJzYBVEMRNto4KZQwXbzV8acma2JBLmZvhhALsKkT5GsQg/MfpMCL46ISKXU63re4rpW0vinZ/dkyncIDWFhsNE= X-Received: by 2002:ac2:5212:0:b0:443:3279:2f34 with SMTP id a18-20020ac25212000000b0044332792f34mr15517577lfl.594.1645482161733; Mon, 21 Feb 2022 14:22:41 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a05:6504:5091:0:0:0:0 with HTTP; Mon, 21 Feb 2022 14:22:41 -0800 (PST) In-Reply-To: References: From: Samuel Wales Date: Mon, 21 Feb 2022 15:22:41 -0700 Message-ID: Subject: Re: profiling latency in large org-mode buffers (under both main & org-fold feature) To: Matt Price Content-Type: text/plain; charset="UTF-8" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::130 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=samologist@gmail.com; helo=mail-lf1-x130.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, 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: Org Mode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" 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=1645482205; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=76QGTeazju2VNE47WYEsU3D8KjkXKCg8afTIadkvNPg=; b=Gyw5FMsnNqyEBG+PTFKojxacjk59YCguVmEdCeasVuMXeGvikF3Yb21pz6bjG38YN1qqBB PLszn59VLlb2IW8p8Hkp/j4SgnKkVXdDr9Ln7a04oZxpPTanGG1zKx6EL62wS1IcK4RGBK n1Nbcl1DrcKpnvKyaJWt9xhJHIrlwJ1EA39cb/3PcxA5Qr6ArVHSeOkHX13ZKxZO7xYsXK kCRE3BCgV/bVGsZVt291LhH1qnNXlwKRMbwXPD9eOjnzBsdWdf1NUTiz2FaAJCa4eTf20m ksqYBGC4mySuZlTKPuSqnDiLisTlB14vsqgiak/jKLDU2Xu4OHWO5X7gbiEvMw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645482205; a=rsa-sha256; cv=none; b=pnX6MHGT6yLkDxCE1qKpel42hK6S76mKn1k5fDggWQPbvpWOFgwh9yI2cb56fVfKI63Dyr PR+6KhUdSlFJEnsBe+9h5lzqQFluf9V8ZhyJ+ysyfYTP5GctlxgJW5TmYWq2c9VN5DURFp xXKUN+Q37bylFia3eUC/rWCF7qQziBc8l3NkqGL3R+QpyN5KcoRT23aISk+c58gcdcodFa eaMWz0XC4Kqt8m0HQc8Ruf0X5snjPDZPRIs0GAg5euv2VuMyUSTftNwCfamCR6nlJeGqcd v+OFQueI5D5+fYXM/uVw+fDNxjXfbi/13giE5n8/aDKdCLvYCD3SzzJ0ByUYDg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="oJHOz/us"; 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: -7.83 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="oJHOz/us"; 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: A9D8513C04 X-Spam-Score: -7.83 X-Migadu-Scanner: scn0.migadu.com X-TUID: lhqMW+9GOfDI i have been dealing with latency also, often in undo-tree. this might be a dumb suggestion, but is it related to org file size? my files have not really grown /that/ much but maybe you could bisect one. as opposed to config. i am not saying that your org files are too big. just that maybe it could lead to insights. On 2/21/22, Matt Price wrote: > I'm trying to figure out what causes high latency while typing in large > org-mode files. The issue is very clearly a result of my large config > file, but I'm not sure how to track it down with any precision. > > My main literate config file is ~/.emacs.d/emacs-init.org, currently 15000 > lines, 260 src blocks. > If I create a ~minimal.el~ config like this: > > (let* ((all-paths > '("/home/matt/src/org-mode/emacs/site-lisp/org"))) > (dolist (p all-paths) > (add-to-list 'load-path p))) > > (require 'org) > (find-file "~/.emacs.d/emacs-init.org") > > then I do not notice any latency while typing. If I run the profiler while > using the minimal config, the profile looks about like this at a high > level: > > 1397 71% - command-execute > 740 37% - funcall-interactively > 718 36% - org-self-insert-command > 686 34% + org-element--cache-after-change > 10 0% + org-fold-core--fix-folded-region > 3 0% + blink-paren-post-self-insert-function > 2 0% + jit-lock-after-change > 1 0% > org-fold-check-before-invisible-edit--text-properties > 9 0% + previous-line > 6 0% + minibuffer-complete > 3 0% + org-return > 3 0% + execute-extended-command > 657 33% - byte-code > 657 33% - read-extended-command > 64 3% - completing-read-default > 14 0% + redisplay_internal (C function) > 1 0% + timer-event-handler > 371 18% - redisplay_internal (C function) > 251 12% + jit-lock-function > 90 4% + assq > 7 0% + substitute-command-keys > 3 0% + eval > 125 6% + timer-event-handler > 69 3% + ... > > -------------------------- > However, if I instead use my fairly extensive main config, latency is high > enough that there's a noticeable delay while typing ordinary words. I see > this regardless of whether I build from main or from Ihor's org-fold > feature branch on github. The profiler overview here is pretty different -- > redisplay_internal takes a much higher percentage of the CPU requirement: > > 3170 56% - redisplay_internal (C function) > 693 12% - substitute-command-keys > 417 7% + # > 59 1% + assq > 49 0% + org-in-subtree-not-table-p > 36 0% + tab-bar-make-keymap > 35 0% and > 24 0% + not > 16 0% org-at-table-p > 13 0% + jit-lock-function > 8 0% keymap-canonicalize > 7 0% + # > 4 0% + funcall > 4 0% display-graphic-p > 3 0% + # > 3 0% file-readable-p > 3 0% + table--probe-cell > 3 0% table--row-column-insertion-point-p > 1486 26% - command-execute > 1200 21% - byte-code > 1200 21% - read-extended-command > 1200 21% - completing-read-default > 1200 21% - apply > 1200 21% - vertico--advice > 475 8% + # > > ---------------------- > I've almost never used the profiler and am not quite sure how I should > proceed to debug this. I realize I can comment out parts of the config one > at a time, but that is not so easy for me to do in my current setup, and I > suppose there are likely to be multiple contributing causes, which I may > not really notice except in the aggregate. > > If anyone has suggestions, I would love to hear them! > > Thanks, > > Matt > -- The Kafka Pandemic A blog about science, health, human rights, and misopathy: https://thekafkapandemic.blogspot.com