GNU bug report logs -
#55481
mostly nonrecursive printing [PATCH]
Previous Next
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
[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)]
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)]
[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.