unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* eieio-debug-methodinvoke
@ 2015-01-21 18:48 Stefan Monnier
  2015-01-22  3:14 ` eieio-debug-methodinvoke Eric Ludlam
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2015-01-21 18:48 UTC (permalink / raw)
  To: Eric M. Ludlam; +Cc: emacs-devel

Hi Eric,

Not sure if you've seen it, but on Emacs's master, EIEIO's
defgeneric/defmethod has been replaced by a brand new implementation (in
cl-generic).  Now that the main part of the switch is done, I'm working
on cleaning up all the regressions that this introduced.

Among them, there's eieio-debug-methodinvoke (in eieio-datadebug.el).
Looking at the code I can kind of see what this is meant to do, but
I can't seem to find a way to make it do something useful (in
Emacs-24.4).
I tried

   emacs -Q -f semantic-mode -l eieio-datadebug
   M-x eieio-debug-methodinvoke RET
   semanticdb-synchronize RET
   (semantic-decoration-unparsed-include-cache "toto") RET

but this just gave me ">#<list o' stuff: 2 entries>".  Do you have
a sample recipe that gives a good/useful result?


        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: eieio-debug-methodinvoke
  2015-01-21 18:48 eieio-debug-methodinvoke Stefan Monnier
@ 2015-01-22  3:14 ` Eric Ludlam
  2015-01-22 16:56   ` eieio-debug-methodinvoke Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Ludlam @ 2015-01-22  3:14 UTC (permalink / raw)
  To: Stefan Monnier, Eric M. Ludlam; +Cc: emacs-devel

On 01/21/2015 01:48 PM, Stefan Monnier wrote:
> Hi Eric,
>
> Not sure if you've seen it, but on Emacs's master, EIEIO's
> defgeneric/defmethod has been replaced by a brand new implementation (in
> cl-generic).  Now that the main part of the switch is done, I'm working
> on cleaning up all the regressions that this introduced.

I did a git pull tonight to check it out. I'm looking forward to trying 
out multiple-dispatch and native type dispatch method handling.  I spent 
a lot of time optimizing the eieio version. Hopefully some of those same 
high level tricks remain.  (Comments indicate so.)

In the meantime, my CEDET can't seem to load old .ede files. :( I'll 
assume I need to recompile or something for now.

> Among them, there's eieio-debug-methodinvoke (in eieio-datadebug.el).
> Looking at the code I can kind of see what this is meant to do, but
> I can't seem to find a way to make it do something useful (in
> Emacs-24.4).
> I tried
>
>     emacs -Q -f semantic-mode -l eieio-datadebug
>     M-x eieio-debug-methodinvoke RET
>     semanticdb-synchronize RET
>     (semantic-decoration-unparsed-include-cache "toto") RET
>
> but this just gave me ">#<list o' stuff: 2 entries>".  Do you have
> a sample recipe that gives a good/useful result?
>

That function was useful when I was trying to get the method invocation 
order to be correct, and I needed a way to debug it. Since those old 
structures are gone, this function won't be needed by me anymore.

As for what it outputs, all the data-debug functions you run into in 
CEDET go into a data-debug mode.  The problem I have debugging programs 
that use eieio objects, and some of the crazy structures that get built 
up in CEDET is that there is so much data, a simple princ (as from 
edebug) just can't tell you what's going on.   As such, all the outputs 
for data-debug are usually very small.  In the above case, just a list 
o' stuff.

Press SPC on any line that indicates there might be more to it, such as 
a #<list o stuff> or #<overlay >  or some # object (usually colored) to 
open it up.  If there are lists upon lists, you can keep drilling in, 
even recursive structures are opened.

Example:
If you have (semantic-mode 1) enabled, you could do:

M-x data-debug-eval-expression RET (semantic-fetch-tags) RET

in some Emacs Lisp buffer.  You can navigate around the data structure 
browsing the tags using SPC to open/close, or n/p to move up/down or N/P 
to move up/down while also opening what's under point.

I have that fcn bound to M-: by default, and hooked into edebug via an A 
binding so I can eval large data values.  I've become quite dependent on it.

Eric



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: eieio-debug-methodinvoke
  2015-01-22  3:14 ` eieio-debug-methodinvoke Eric Ludlam
@ 2015-01-22 16:56   ` Stefan Monnier
  2015-01-22 19:51     ` eieio-debug-methodinvoke Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2015-01-22 16:56 UTC (permalink / raw)
  To: Eric Ludlam; +Cc: Eric M. Ludlam, emacs-devel

> I did a git pull tonight to check it out. I'm looking forward to trying out
> multiple-dispatch and native type dispatch method handling.  I spent a lot
> of time optimizing the eieio version. Hopefully some of those same high
> level tricks remain.  (Comments indicate so.)

I haven't made a thorough comparison, but it seems that the new
dispatch code is significantly faster.  Here's the little test I used:

   (defclass sm-class0 () ())
   (defclass sm-class1 () ())
   
   (defmethod sm-fib ((x sm-class0)) 0)
   (defmethod sm-fib ((x sm-class1)) 1)
   (defmethod sm-fib (x)
     (cond ((eq x 0) (sm-fib (sm-class0 "toto")))
           ((eq x 1) (sm-fib (sm-class1 "toto")))
           (t (+ (sm-fib (- x 1)) (sm-fib (- x 2))))))

I byte-compiled it with emacs-24, and then ran the .elc with both
emacs-24 and master: for (sm-fib 23), the emacs-24 code took about twice
as much time to complete.

> In the meantime, my CEDET can't seem to load old .ede files. :( I'll assume
> I need to recompile or something for now.

It "should" work without recompiling anything.  So please, before
recompiling, try to keep the problem around to see if we can fix it.

> That function was useful when I was trying to get the method invocation
> order to be correct, and I needed a way to debug it.  Since those old
> structures are gone, this function won't be needed by me anymore.

Ah, that makes sense.

> Press SPC on any line that indicates there might be more to it, such
> as a #<list o stuff> or #<overlay >  or some # object (usually colored) to
> open it up.  If there are lists upon lists, you can keep drilling in, even
> recursive structures are opened.

Aha!

> Example:
> If you have (semantic-mode 1) enabled, you could do:
> M-x data-debug-eval-expression RET (semantic-fetch-tags) RET
> in some Emacs Lisp buffer.  You can navigate around the data structure
> browsing the tags using SPC to open/close, or n/p to move up/down or N/P to
> move up/down while also opening what's under point.

Ah, nice, indeed (tho I wouldn't put a quote in front of symbols since
that confuses the difference between the value and an expression which
returns this value).

> I have that fcn bound to M-: by default, and hooked into edebug via
> an A binding so I can eval large data values.  I've become quite dependent
> on it.

Its interactive spec should probably use read--expression (which clearly
needs to be renamed to something without "--") so as to get completion.


        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: eieio-debug-methodinvoke
  2015-01-22 16:56   ` eieio-debug-methodinvoke Stefan Monnier
@ 2015-01-22 19:51     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2015-01-22 19:51 UTC (permalink / raw)
  To: Eric Ludlam; +Cc: Eric M. Ludlam, emacs-devel

> I byte-compiled it with emacs-24, and then ran the .elc with both
> emacs-24 and master: for (sm-fib 23), the emacs-24 code took about twice
> as much time to complete.

Interestingly, after replacing the "defmethod" with "cl-defmethod" in
the test, I get an additional factor of 4 speedup on this test
(i.e. 3.8s with emacs-24, 2s with trunk, 0.5s with cl-defmethod).


        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-22 19:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-21 18:48 eieio-debug-methodinvoke Stefan Monnier
2015-01-22  3:14 ` eieio-debug-methodinvoke Eric Ludlam
2015-01-22 16:56   ` eieio-debug-methodinvoke Stefan Monnier
2015-01-22 19:51     ` eieio-debug-methodinvoke Stefan Monnier

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).