From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#71367: 30.0.50; ELPA package breadcrumb causes Emacs freeze when editing json file Date: Thu, 06 Jun 2024 12:35:38 +0300 Message-ID: <867cf2ifbp.fsf@gnu.org> References: <87tti8binx.fsf@fastmail.fm> <874ja7ua1m.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36272"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71367@debbugs.gnu.org, theo@thornhill.no, tsdh@gnu.org To: Andrea Corallo , joaotavora@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 06 11:37:06 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 1sF9YQ-0009FX-Dd for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 06 Jun 2024 11:37:06 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sF9Y9-0001b2-7K; Thu, 06 Jun 2024 05:36:49 -0400 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 1sF9Y7-0001aO-MR for bug-gnu-emacs@gnu.org; Thu, 06 Jun 2024 05:36:47 -0400 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 1sF9Y7-0007Rh-Ee for bug-gnu-emacs@gnu.org; Thu, 06 Jun 2024 05:36:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sF9YL-0000s7-UP for bug-gnu-emacs@gnu.org; Thu, 06 Jun 2024 05:37:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 06 Jun 2024 09:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71367 X-GNU-PR-Package: emacs Original-Received: via spool by 71367-submit@debbugs.gnu.org id=B71367.17176665653272 (code B ref 71367); Thu, 06 Jun 2024 09:37:01 +0000 Original-Received: (at 71367) by debbugs.gnu.org; 6 Jun 2024 09:36:05 +0000 Original-Received: from localhost ([127.0.0.1]:52368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sF9XR-0000qh-58 for submit@debbugs.gnu.org; Thu, 06 Jun 2024 05:36:05 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34444) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sF9XP-0000qA-1q for 71367@debbugs.gnu.org; Thu, 06 Jun 2024 05:36:03 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sF9X4-0007NG-Ol; Thu, 06 Jun 2024 05:35:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=XSvp3lAbVZfYePPMfZQywNu/Gk/zar0or8qexA/w2Eo=; b=fqdeW5PG/0HYyoL65KrV XVozjc0UEF03uxbSgPVJEBQ5RX2qYx5jiwc/zq049lyXDP5mFqUPFEej97tuAslQXfssXTAWZ6Xnn nz7ZbjvI5oiddeOhSPmtKvLkQaLkGi8pXGl/uRKTkazyhgqC/ScUKIb/G3x0ItLETbOen/pNc8Hps e1WPpoYxmdP/3MQRkZ8yKOL0YwzEhRE7Cu8zePZzg7q+ChIDuepHGWTrQc40y0xPHvb/hWBnmQcMa nQayDg9QWIkIshU1VabAZJg/sgroQ9Vj2Bb6CH0UP370jTuDLOqZe40ZDnXLB0zGaSj7INE4Hqi1a oOJNzCHcet0FUg==; In-Reply-To: (message from Andrea Corallo on Wed, 05 Jun 2024 05:36:23 -0400) 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:286677 Archived-At: > Cc: 71367@debbugs.gnu.org, Theodor Thornhill , > João Távora > From: Andrea Corallo > Date: Wed, 05 Jun 2024 05:36:23 -0400 > > Tassilo Horn writes: > > > Ok, now I tested with > > > > emacs -Q --load ~/recipe-71367@debbugs.gnu.org.el > > > > where the recipe is: > > > > (progn > > ;; Native compile doesn't make a difference... > > (setq native-comp-jit-compilation-deny-list '(".*breadcrumb.*")) > > (package-initialize) > > (package-activate 'breadcrumb) > > (breadcrumb-mode) > > ;; Using json-ts-mode is essential! > > (add-to-list 'major-mode-remap-alist '(js-json-mode . json-ts-mode)) > > (find-file "~/mirrorstatus.json")) > > > > Before firing up Emacs, I've deleted the breadcrumb ELN file. > > > > With the above recipe, Emacs instantly freezes when the file gets > > displayed. It doesn't freeze, it just takes a very long time to perform the initial redisplay after visiting the file. With my unoptimized build of Emacs 30, it takes something like a full minute until the "freeze" ends. Optimized builds should do that in, like, 15 to 20 sec, I'd expect. Thereafter the breadcrumbs display on the header line works just fine. The importance of using json-ts-mode is simply because it defines support for Imenu, whereas the default js-json-mode does not. With Imenu support turned on, imenu--index-alist is a huge nested structure for this large file: there are 17500 elements there. The first time breadcrumb-mode is invoked, it loops over all those elements doing its thing in breadcrumb--summarize, and that takes both time and a lot of consing (which triggers a lot of GC, which slows down this even more). That's all. Maybe João could suggest some trick or user option to cut down that initial time to reasonable level. Failing that, I suggest not to enable breadcrumb-mode in such large JSON buffers (something that can be done in a mode hook, I guess?)