From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id kJyCD0p1FGK8EQEAgWs5BA (envelope-from ) for ; Tue, 22 Feb 2022 06:31:54 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id QNvmDEp1FGIdDQAA9RJhRA (envelope-from ) for ; Tue, 22 Feb 2022 06:31: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 D544F2985A for ; Tue, 22 Feb 2022 06:31:53 +0100 (CET) Received: from localhost ([::1]:50852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nMNmB-0004X6-Bl for larch@yhetil.org; Tue, 22 Feb 2022 00:31:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMNlg-0004Wy-OG for emacs-orgmode@gnu.org; Tue, 22 Feb 2022 00:31:20 -0500 Received: from [2a00:1450:4864:20::329] (port=34206 helo=mail-wm1-x329.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nMNle-0003UT-Vf for emacs-orgmode@gnu.org; Tue, 22 Feb 2022 00:31:20 -0500 Received: by mail-wm1-x329.google.com with SMTP id l2-20020a7bc342000000b0037fa585de26so437279wmj.1 for ; Mon, 21 Feb 2022 21:31:18 -0800 (PST) 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; bh=jN+wk6y60DhuyJOO/MSFpvn3ugsVa2tync6QuXVUdYE=; b=buE673iK18+/32vIKak7A8vnWGbHcIQbLInrD28hLwHdPO91811D0QqkzhQoq/IglA tjLnkVHR5s/EKw7bMKg5A9WzXs690AIZtDC0XAj7pXtxrK5CT3XjK6ozF9M/CHdmZJbu x1DuykCWBc9Bi3C9CU4v49oim+uiQuRp3tMZuKXh8M8j94ejn8yZDJVL2ebnTeSkg+kC OR9dhkgQ231Jc13Shb3BVRJnbcyRoBli6go8ms3zh6OmGneOaESS6YyX3SMe+VOStCZM 7gT6yMfNla0O6Vbv+C+CuJ6SkKujSaHT6x/2Q2Sc7mKB17pXDycyO/RhiB/FRYsxRa2B mTRg== 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; bh=jN+wk6y60DhuyJOO/MSFpvn3ugsVa2tync6QuXVUdYE=; b=DmzuhZSXLh309SwZ9ngbChZKKZZVi1kD2URjpdJXMQXSpG/pwaObKGsjrR9QWWyA9a LIYGkI12ukBxqMbpyShBib5n3GcIKiWOpFaGYzdL4oqKE25KS+2VtRCvwC7PwpUwqgtm fu5p5NG55sKO5AG9GHkLKHjwN7Figqq7r8wrXj/9fhe4cl3pVe6F+Sc228lUhCXZr+0L J8ei9Xi+6UraJmTrUnemI4hg3MRLaVVBQ/R7eo1izO3WcXDAI2nMdj5aNhh0B+WA1PUc qNYnTjhHNbvi3QwnWrg2Qh7ACsZOtTppUZjrzM6Jq8tYTfAD5t94gd5QtZlUduWMwUVK qswQ== X-Gm-Message-State: AOAM532G2ZKE4vK8jZQAN+eQZ3plLxQx+Fl/uN9iR347D0peIDiC8KX1 d0mT4ob8Ig9HVf8V9XPwqAo= X-Google-Smtp-Source: ABdhPJydNqxdUOvqBYfQ6ucHLb69IgybFrbTu+Io4cqIJ4Su/W2q3DFiO89ETnrxU8gaeeDSCf8Fyg== X-Received: by 2002:a05:600c:22d2:b0:37b:c4bf:c6d5 with SMTP id 18-20020a05600c22d200b0037bc4bfc6d5mr1729275wmg.125.1645507876612; Mon, 21 Feb 2022 21:31:16 -0800 (PST) Received: from localhost ([158.255.2.9]) by smtp.gmail.com with ESMTPSA id d29sm19122711wra.63.2022.02.21.21.31.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 21:31:16 -0800 (PST) From: Ihor Radchenko To: Matt Price Subject: Re: profiling latency in large org-mode buffers (under both main & org-fold feature) In-Reply-To: References: Date: Tue, 22 Feb 2022 13:30:48 +0800 Message-ID: <87ilt7piwn.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::329 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=yantar92@gmail.com; helo=mail-wm1-x329.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: 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=1645507913; 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=jN+wk6y60DhuyJOO/MSFpvn3ugsVa2tync6QuXVUdYE=; b=W+FlVQ3m3FgG5itW7OA8MNSevm+uj6faLxLuTqZP3l/x1ChFSD5BZ2YdgsJcf2FbRbadsM M85ZiD5f3cVLleQyst1y0FDEN32u/8LVrVdfxAJsoaEhV1RcZIs/ZRsdenpjaCNih5yaLo xygZTwsa5BtTr5usuEjvaSo9Dwzct7fWYU6zpI8R/AYNhvFr5IwpWm5X0/QzoithtZY453 Hkmqa0vfzCzuAOtT53wLP+aaGnBaHybzsCx/pfW8qUpvGHu7vxOpSRGZTysbWZ+P2/z0Y8 RvoPxHp9JmjZ/JkqmWqjIumC6FzFhh9FblU3c3VroSce79EWDFyUsGFNmVSCKA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645507913; a=rsa-sha256; cv=none; b=fRW/2y1Id/Io7degyRHUUyD2R2jpupsAYuo65Q8DTEjvukmJLzo0wnVi5UuMANTo+ocGX9 kOn1n2ujIsgMHelMEsTlkdOP4w3nhj9qJuUmuzxXpNUN9rnO8FLiOvW4D4r+kYJRntIF+I Ojr0ITTxb2LzeV/yinPdPwIk6kj4Q4nUKcYmWIKiSZBPtGQKG4kCBUeV9wD0pPOwK3M28T Wiwb8utzv3G2RBg9Fn3q+HQxEKJkXjFeGRmJAThLw9JP6ayDUyCuA3Q+fs+1qc7Yx0q5YA D4IIDD55zMZTsjrBfJqdW1wDKpN5TnVSKp4zjJzhkQvXpNFqOfQac+e8kqrLwg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=buE673iK; 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: -6.13 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=buE673iK; 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: D544F2985A X-Spam-Score: -6.13 X-Migadu-Scanner: scn0.migadu.com X-TUID: 02hW9vv819HM Matt Price writes: > 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) > .... > 1200 21% - completing-read-default > 1200 21% - apply > 1200 21% - vertico--advice > 475 8% + # Judging from the profiler report, you did not collect enough number of CPU samples. I recommend to keep the profiler running for at least 10-30 seconds when trying to profile typing latency. Also, note that running M-x profiler-report second time will _not_ reproduce the previous report, but instead show CPU profiler report between the last invocation of profiler-report and the second one. I recommend to do the following: 1. M-x profiler-stop 2. M-x profiler-start 3. Do typing in the problematic Org file for 10-30 seconds 4. M-x profiler-report (once!) 5. Share the report here > 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. The above steps should be the first thing to try and they will likely reveal the bottleneck. If not, you can go back to genetic bisection. I do not recommend manual commenting/uncommenting parts of you large config. Instead, you can try https://github.com/Malabarba/elisp-bug-hunter. But only if CPU profiling does not reveal anything useful. Best, Ihor