unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] emacs-24 r117502: Always use matched specpdl entry to record call arguments (Bug#18473).
       [not found] <E1XTk0z-0007j7-Dg@vcs.savannah.gnu.org>
@ 2014-09-16 14:13 ` Stefan Monnier
  2014-09-16 16:22   ` Dmitry Antipov
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2014-09-16 14:13 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: emacs-devel

> -void
> +ptrdiff_t
>  record_in_backtrace (Lisp_Object function, Lisp_Object *args, ptrdiff_t nargs)
>  {
> +  ptrdiff_t count = SPECPDL_INDEX ();
> +
>    eassert (nargs >= UNEVALLED);
>    specpdl_ptr-> bt.kind = SPECPDL_BACKTRACE;
>    specpdl_ptr-> bt.debug_on_exit = false;
> @@ -2049,6 +2045,8 @@
>    specpdl_ptr-> bt.args = args;
>    specpdl_ptr-> bt.nargs = nargs;
>    grow_specpdl ();
> +
> +  return count;
>  }

This will slow down every single function call.  Not by much, but
they're already pretty slow, so we should work hard not to make it worse.

In this respect, your previous patch (which used backtrace_top instead
of keeping a `count') was better since it only affected *some*
function calls.


        Stefan



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

* Re: [Emacs-diffs] emacs-24 r117502: Always use matched specpdl entry to record call arguments (Bug#18473).
  2014-09-16 14:13 ` [Emacs-diffs] emacs-24 r117502: Always use matched specpdl entry to record call arguments (Bug#18473) Stefan Monnier
@ 2014-09-16 16:22   ` Dmitry Antipov
  2014-09-16 16:51     ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Antipov @ 2014-09-16 16:22 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On 09/16/2014 06:13 PM, Stefan Monnier wrote:

> This will slow down every single function call.  Not by much, but
> they're already pretty slow, so we should work hard not to make it worse.

IMO if we really care about speed in eval_sub, we should redesign this first:

   2111    if (SUBRP (fun))
   2112      {
   2113        Lisp_Object numargs;
   2114        Lisp_Object argvals[8];
   2115        Lisp_Object args_left;
   2116        register int i, maxargs;
   2117
   2118        args_left = original_args;
   2119        numargs = Flength (args_left);     <-- bad

Generic Flength is too slow due to monster if...else:

    121    if (STRINGP (sequence))
    122      XSETFASTINT (val, SCHARS (sequence));
    123    else if (VECTORP (sequence))
    124      XSETFASTINT (val, ASIZE (sequence));
    125    else if (CHAR_TABLE_P (sequence))
    126      XSETFASTINT (val, MAX_CHAR);
    127    else if (BOOL_VECTOR_P (sequence))
    128      XSETFASTINT (val, bool_vector_size (sequence));
    129    else if (COMPILEDP (sequence))
    130      XSETFASTINT (val, ASIZE (sequence) & PSEUDOVECTOR_SIZE_MASK);
    131    else if (CONSP (sequence))

and we know that args_left is always a list.

Dmitry




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

* Re: [Emacs-diffs] emacs-24 r117502: Always use matched specpdl entry to record call arguments (Bug#18473).
  2014-09-16 16:22   ` Dmitry Antipov
@ 2014-09-16 16:51     ` Stefan Monnier
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2014-09-16 16:51 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: emacs-devel

> IMO if we really care about speed in eval_sub,

I don't (it should only impact non-compiled code).  But I do care about
Ffuncall which also calls record_in_backtrace.


        Stefan



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

end of thread, other threads:[~2014-09-16 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <E1XTk0z-0007j7-Dg@vcs.savannah.gnu.org>
2014-09-16 14:13 ` [Emacs-diffs] emacs-24 r117502: Always use matched specpdl entry to record call arguments (Bug#18473) Stefan Monnier
2014-09-16 16:22   ` Dmitry Antipov
2014-09-16 16:51     ` 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).