From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#74357: c-mode: Some syntactic constructs cause unreasonable typing lag Date: Fri, 15 Nov 2024 14:45:02 +0000 Message-ID: References: <86v7wphrmi.fsf@gnu.org> <86ed3cinfg.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16706"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, =?UTF-8?Q?Bj=C3=B6rn?= Lindqvist , 74357@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 15 15:46:22 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tBxaX-00049A-Ie for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 Nov 2024 15:46:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBxaK-0003M0-4A; Fri, 15 Nov 2024 09:46:08 -0500 Original-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 1tBxaE-0003KO-HY for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 09:46:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBxaE-0004ga-8A for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 09:46:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=From:In-Reply-To:MIME-Version:References:Date:To:Subject; bh=N66YAQq63YzJsUgsd0XcrN57AJqXSEpU7v/Dr5dCVb4=; b=Au/SzvDbgXNpmlrvtr0cw4ul0LtyWtV4flCLxQQp58wqBxYzhf6PgGB6PpyzHTWb3zezRmPifpqP/3K3wUQpOX27reVbHOIuPuYieb4d6vF/gLY1vWUPEQ2UYuWEvOzkpM7t/a9BO6E1PphQQkLnRqBSd9GhjA67B3Q6YCBCYVXA37grdibhUru+ojJPl2D34hM2Tjbfp+KnL/KmSYW8y4h82ECdr6UMJxxZweD4+GovkQIIUof4lW/OqupWLZM+JN48qHHZnqmwfC3knf2EXgzde1VV4sdogaTR8T8mEJ+4YfmxErKBDJgdEi/HIK7LfzMjSQ72aEUQPfEO4CESxQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tBxaE-0008K5-1K for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 09:46:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Nov 2024 14:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74357 X-GNU-PR-Package: emacs Original-Received: via spool by 74357-submit@debbugs.gnu.org id=B74357.173168191431701 (code B ref 74357); Fri, 15 Nov 2024 14:46:01 +0000 Original-Received: (at 74357) by debbugs.gnu.org; 15 Nov 2024 14:45:14 +0000 Original-Received: from localhost ([127.0.0.1]:49128 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBxZP-0008DX-1s for submit@debbugs.gnu.org; Fri, 15 Nov 2024 09:45:14 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:11189) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBxZN-0008D0-La for 74357@debbugs.gnu.org; Fri, 15 Nov 2024 09:45:10 -0500 Original-Received: (qmail 70979 invoked by uid 3782); 15 Nov 2024 15:45:03 +0100 Original-Received: from muc.de (p4fe1581d.dip0.t-ipconnect.de [79.225.88.29]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 15 Nov 2024 15:45:03 +0100 Original-Received: (qmail 14553 invoked by uid 1000); 15 Nov 2024 14:45:02 -0000 Content-Disposition: inline In-Reply-To: <86ed3cinfg.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:295396 Archived-At: Hello, Eli and Björn. On Fri, Nov 15, 2024 at 16:25:39 +0200, Eli Zaretskii wrote: > > From: Björn Lindqvist > > Date: Fri, 15 Nov 2024 15:08:09 +0100 > > Cc: Alan Mackenzie , 74357@debbugs.gnu.org > > > I've wrapped the snippet with 50 foo, and I still don't see any > > > significant lags. > > > Does it matter where you type, for reproducing the lag? > > > Also, can you run this under a profiler (M-x profiler-start) and then > > > show the full expanded profile produced by "M-x profiler-report" after > > > several tens of seconds of typing with the lag? > > > Adding Alan to the discussion. > > Hello Eli, thanks for the swift reply. > > I've created a much larger example so you can see what I mean with > > "wrapping foo in foo": > > https://gist.github.com/bjourne/8f705c5879aa966accf354008623f6bb > > Open file in c-mode, Go to line 328, place the cursor on "y" in "dy_dim" > > and press and hold "y". Unless you have a supercomputer the lag will be > > really apparent. Disable Global Font-lock mode and repeat the exercise. > > Lag will be gone. Lag is worse if I use non-jitted Emacs, but really > > apparent in jitted Emacs too. Lag goes away if I use c-ts-mode instead > > of c-mode. > Yes, I see the lag now, thanks; the profile is below. I'll let Alan > look into this and see how this can be improved. Thanks, Eli! I'll look into this. > > I want to emphasize that lag is present in normal code too, but easier > > to detect in these specially crafted samples. > Can you tell where in real life do you see such deeply-nested braces > in C source files? > Here's the profile I collected: [ .... ] -- Alan Mackenzie (Nuremberg, Germany).