From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ravine Var Newsgroups: gmane.emacs.bugs Subject: bug#45248: 28.0.50; Emacs freezes with big C functions Date: Fri, 18 Dec 2020 16:47:36 +0530 Message-ID: <87lfdvmjpw.fsf@gmail.com> References: <87a6ufen1w.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33726"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.5.7; emacs 28.0.50 Cc: 45248@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 18 12:35:31 2020 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 1kqE2l-0008cz-90 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Dec 2020 12:35:31 +0100 Original-Received: from localhost ([::1]:59000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqE2k-0000Ag-6f for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Dec 2020 06:35:30 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59132) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqE2I-00007q-AT for bug-gnu-emacs@gnu.org; Fri, 18 Dec 2020 06:35:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54542) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kqE2I-0005hL-1u for bug-gnu-emacs@gnu.org; Fri, 18 Dec 2020 06:35:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kqE2H-0000M6-US for bug-gnu-emacs@gnu.org; Fri, 18 Dec 2020 06:35:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ravine Var Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Dec 2020 11:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45248 X-GNU-PR-Package: emacs Original-Received: via spool by 45248-submit@debbugs.gnu.org id=B45248.16082912881340 (code B ref 45248); Fri, 18 Dec 2020 11:35:01 +0000 Original-Received: (at 45248) by debbugs.gnu.org; 18 Dec 2020 11:34:48 +0000 Original-Received: from localhost ([127.0.0.1]:37855 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kqE24-0000LY-Ig for submit@debbugs.gnu.org; Fri, 18 Dec 2020 06:34:48 -0500 Original-Received: from mail-pf1-f172.google.com ([209.85.210.172]:41679) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kqE21-0000LL-Oo for 45248@debbugs.gnu.org; Fri, 18 Dec 2020 06:34:47 -0500 Original-Received: by mail-pf1-f172.google.com with SMTP id t8so1371951pfg.8 for <45248@debbugs.gnu.org>; Fri, 18 Dec 2020 03:34:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:date:in-reply-to :message-id:mime-version; bh=O2R+/jr53GfSaf30dmy35teql2vzk6lrV/vFXVuqEw8=; b=P6DYuhvdJp5aIEnsZt0/2vG/OLtwzFvsKzFyGLPPTIwMYL5WHlVl2rm4LXvC219g97 3LaX851fKNClsOT8u7shX5kZBv+fSN9+ZVWm1C7PKQ9cpgGjTB1p3IvpbikEmZ7iVXCP Y9jf6sWz34bzuaxFpRK7RMh75ZVwglWS4tF1Nzy9x1iHBuOG4YVDm82Xg0YbhG1NyCTs bLBFMmeX6IqBk5+K1MASnjhSPdcU1rlP+9sJyYpLtpQCE33aONu0MyEncXBpxxFU0KVh 2wclrQcVrABM41zd+NNZkidzfll1ekfMci6JeoMypekTbxLieJxzV2RYEMCbPRe1cnUh UDjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject:date :in-reply-to:message-id:mime-version; bh=O2R+/jr53GfSaf30dmy35teql2vzk6lrV/vFXVuqEw8=; b=BjcqNts6dSve3QcqH5TgqGnTJyhBbNDkAl1P5Rg3J7D1eWXN2dDY9lGTUZXZir8WI7 9JIDyuWK2hE34rbnNtnTqIK4ZK2b9w+UDjqj2FMhmjV6hHdG1a4+PLhSExfR0NZkh9sW WQXIZhkGdGcCtpa8OK3QyQy1wH7pR3SRrll+ujzsv46zgZXOCQtGygv9rvpicJsKvYM7 egIBoAE08zM9qWVcMM4SwGYqXh9aN3DWL/a8C1e5LpmFmVh2Fi/YtHutOGoPaPOYq7pR PBnmEMlpZ2Z8EPLAv8/5vhRXodr9dVvG4mqCXXHDn/1mFMol38y4bKZPT05n+tn31Sfw jSDA== X-Gm-Message-State: AOAM5334E6e8ltXUItiVXo6NV0v/760yWE3Hn1adxtDzQ9H5KD/xe4Pj TPokytDlbr7P63W9qYUgOL12KM2utVU= X-Google-Smtp-Source: ABdhPJy70IEiKGKbe3Pk7AFV8iLDkljKC3h3gUGW6t7hhwIG8mlQaOh0gO2jCXKmjF24iWUlpH8g4Q== X-Received: by 2002:a62:2585:0:b029:1ab:7fb7:b965 with SMTP id l127-20020a6225850000b02901ab7fb7b965mr1914711pfl.2.1608291279378; Fri, 18 Dec 2020 03:34:39 -0800 (PST) Original-Received: from ryzen-mach ([2409:4072:e87:49af:4b4a:d2e8:6eaf:82aa]) by smtp.gmail.com with ESMTPSA id t18sm8959954pfl.138.2020.12.18.03.34.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Dec 2020 03:34:38 -0800 (PST) In-reply-to: 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" Xref: news.gmane.io gmane.emacs.bugs:196317 Archived-At: Alan Mackenzie writes: > As Eli surmised, the problem is the very large static struct in the > function. > > The solution appears to be to cache positions within structs, so that > the function searching back over brace lists needn't do so repeatedly in > the same piece of buffer. > > I'm hoping that the following patch which implements this cache will > solve the problem. Would you please apply it to your copy of the master > branch, byte compile it, and try it out on various CC Mode buffers. > Then please let me know how well it has fixed the bug. Thanks! The patch didn't apply cleanly on master, but it still went through. progmodes $ patch -p1 < ~/Downloads/patches/bug_45248_message_11.mbox patching file cc-engine.el Hunk #1 succeeded at 3567 (offset -7 lines). Hunk #2 succeeded at 11616 (offset -12 lines). Hunk #3 succeeded at 11825 (offset -12 lines). Hunk #4 succeeded at 11909 (offset -12 lines). patching file cc-mode.el Hunk #1 succeeded at 639 with fuzz 2 (offset 12 lines). Hunk #2 succeeded at 2056 (offset 20 lines). Hunk #3 succeeded at 2209 (offset 22 lines). Hunk #4 succeeded at 2229 (offset 22 lines). Hunk #5 succeeded at 2271 (offset 22 lines). Testing with the large structure copied into a file showed some initial improvement, but the screen still locked up once scrolling reached 15% or so. Enabling fast-but-imprecise-scrolling allowed scrolling to happen, but there was lots of stuttering. Profile report with emacs -Q on a Ryzen-based machine (no fast-but-imprecise-scrolling): https://gist.github.com/ravine-var/0116c20477dce725b02543a85e91cbab