unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 25295@debbugs.gnu.org
Subject: bug#25295: 26.0.50; Represent eieio objects using object-print in backtraces and edebug
Date: Sat, 21 Oct 2017 14:36:46 -0700	[thread overview]
Message-ID: <87efpww5ch.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <jwv7f48xjk4.fsf-monnier+bug#25295@gnu.org> (Stefan Monnier's message of "Thu, 02 Mar 2017 02:00:53 -0500")


On 03/02/17 02:00 AM, Stefan Monnier wrote:
>> Objects have an `object-print' method which produces the #<foo>
>> representation, but this appears to only sometimes be used in edebug,
>> and never in backtraces.
>
> I've installed a cl-print.el package into Emacs's master branch which is
> like EIEIO's object-print but more thorough.  This is now used in
> edebug, so it should hopefully fix the "only sometimes" part (and it
> additionally knows about cl-defstructs as well, rather than only EIEIO
> objects).
>
> Using it in backtraces should be a simple matter of applying the patch
> below.  I haven't installed it because I'm afraid of the potential
> breakage and slowdown of using cl-prin1, so I'd rather wait and see how
> it fares in Edebug first.  My experiments seem to indicate that it might
> be "good enough" but it might also suffer from the overhead of
> cl-generic (mostly the fact that a call to a generic-function ends up
> going through some &rest+apply which in cl-print's case end up
> generating a lot of garbage: in one of my tests, the cl-print code was
> twice slower than the C code but the added time was almost entirely
> spent in the GC and that seemed to come exclusively from the lists
> allocated for &rest.  I.e. if we could change cl-generic so it doesn't
> use &rest+apply as much there's a chance it could potentially be about
> as fast as the C code).
>
>
>         Stefan
>
>
> diff --git a/lisp/subr.el b/lisp/subr.el
> index ea159e733c..68bfceb8d2 100644
> --- a/lisp/subr.el
> +++ b/lisp/subr.el
> @@ -4660,10 +4660,10 @@ backtrace--print-frame
>    (princ (if (plist-get flags :debug-on-exit) "* " "  "))
>    (cond
>     ((and evald (not debugger-stack-frame-as-list))
> -    (prin1 func)
> -    (if args (prin1 args) (princ "()")))
> +    (cl-prin1 func)
> +    (if args (cl-prin1 args) (princ "()")))
>     (t
> -    (prin1 (cons func args))))
> +    (cl-prin1 (cons func args))))
>    (princ "\n"))
>  
>  (defun backtrace ()

How about we just apply this and see what happens? Developing with EIEIO
is pretty painful -- oftentimes the *Messages* buffer is such a mess you
can't even tell if there's been an error or not.

I've been running the above patch, as well as an equivalent change in
`eval-expression', and nothing bad has happened. Perhaps there's a
slowdown, but from my own selfish point of view any slowdown is far, far
preferable to the several seconds you need to wait for a class object to
be spat out into *Messages*.

BTW, this works in edebug but only at the top level: if a nested
structure is printed, interior objects are still represented as the full
struct.





  parent reply	other threads:[~2017-10-21 21:36 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-29 20:52 bug#25295: 26.0.50; Represent eieio objects using object-print in backtraces and edebug Eric Abrahamsen
     [not found] ` <handler.25295.B.148304476023950.ack@debbugs.gnu.org>
2016-12-29 21:50   ` bug#25295: Acknowledgement (26.0.50; Represent eieio objects using object-print in backtraces and edebug) Eric Abrahamsen
2016-12-30  3:42     ` npostavs
2016-12-30 19:14       ` Eric Abrahamsen
2016-12-31  5:48         ` npostavs
2016-12-31 18:56           ` Eric Abrahamsen
2016-12-31 19:23             ` npostavs
2016-12-31 20:52               ` Eric Abrahamsen
2016-12-30  7:51     ` Eli Zaretskii
2017-01-03 18:21     ` bug#25295: Represent eieio objects using object-print in backtraces and edebug Stefan Monnier
2017-01-04 23:40       ` Eric Abrahamsen
2017-01-05  1:51         ` Stefan Monnier
2017-01-05  2:11           ` Stefan Monnier
2017-01-05  4:37             ` Stefan Monnier
2017-01-05 15:39               ` Eli Zaretskii
2017-01-06  0:42                 ` Stefan Monnier
2017-01-06  7:50                   ` Eli Zaretskii
2017-02-21  2:56               ` npostavs
2017-02-21 17:23                 ` Stefan Monnier
2017-02-22 16:15                   ` Richard Stallman
2017-02-22 19:08                     ` Stefan Monnier
2017-03-02  7:00 ` bug#25295: 26.0.50; " Stefan Monnier
2017-03-02 12:52   ` npostavs
2017-03-02 13:38     ` Stefan Monnier
2017-03-11  5:43       ` npostavs
2017-03-02 17:35   ` Eric Abrahamsen
2017-03-02 18:31     ` Stefan Monnier
2017-10-21 21:36   ` Eric Abrahamsen [this message]
2017-10-22  3:21     ` Stefan Monnier
2018-10-18 19:01       ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87efpww5ch.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=25295@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).