GNU bug report logs - #55481
mostly nonrecursive printing [PATCH]

Previous Next

Package: emacs;

Reported by: Mattias Engdegård <mattiase <at> acm.org>

Date: Tue, 17 May 2022 14:00:02 UTC

Severity: normal

Tags: patch

Done: Mattias Engdegård <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Mattias Engdegård <mattiase <at> acm.org>
Subject: bug#55481: closed (Re: bug#55481: mostly nonrecursive printing
 [PATCH])
Date: Wed, 18 May 2022 09:08:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#55481: mostly nonrecursive printing [PATCH]

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 55481 <at> debbugs.gnu.org.

-- 
55481: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=55481
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Mattias Engdegård <mattiase <at> acm.org>
To: Eli Zaretskii <eliz <at> gnu.org>, Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55481-done <at> debbugs.gnu.org
Subject: Re: bug#55481: mostly nonrecursive printing [PATCH]
Date: Wed, 18 May 2022 11:07:19 +0200
17 maj 2022 kl. 17.48 skrev Eli Zaretskii <eliz <at> gnu.org>:

> Thanks, this is an important improvement, IMO.

17 maj 2022 kl. 19.41 skrev Lars Ingebrigtsen <larsi <at> gnus.org>:

> Yup; sounds excellent.

Thank you both! Now pushed to master.


[Message part 3 (message/rfc822, inline)]
From: Mattias Engdegård <mattiase <at> acm.org>
To: bug-gnu-emacs <at> gnu.org
Subject: mostly nonrecursive printing [PATCH]
Date: Tue, 17 May 2022 15:59:16 +0200
[Message part 4 (text/plain, inline)]
Printing deeply nested values typically crashes Emacs by running out of C stack since the printer uses C recursion to traverse nested data structures. This is a long-standing problem that keeps turning up; see bug#52753 for one example.

The attached patch eliminates most of the recursion: conses, vectors, records, hash tables and char tables are now traversed without consuming C stack. This should cover the vast majority of objects that form deep structures.

Of note:

- Performance seems to be slightly improved (about 2.5 % faster for printing a long list of symbols) but that's not really the point of the patch.

- The patch does not attempt to fix the bogus #N notation for circular lists (bug#55395) but tries to stay bug-compatible for easier comparison.

- Some special syntax is context-conditional: (\, X) is only printed as ,X if surrounded by a positive number of backquote forms. It's not clear what we gain from this; using the special syntax for the backquote, comma and comma-at forms unconditionally would simplify matter without any apparent inconvenience to the user. Right now, the patch does not remove recursion for printing these forms.

- This patch does not address reading nested values, where a similar problem exists.

[print-nonrec.diff (application/octet-stream, attachment)]

This bug report was last modified 3 years and 6 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.