all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#35562: "varset" bytecode inline path is never taken
@ 2019-05-04 13:27 Simon Frankau
  2019-05-04 16:10 ` Noam Postavsky
  2019-05-04 18:16 ` Paul Eggert
  0 siblings, 2 replies; 3+ messages in thread
From: Simon Frankau @ 2019-05-04 13:27 UTC (permalink / raw)
  To: 35562

[-- Attachment #1: Type: text/plain, Size: 704 bytes --]

While reading the source, I noticed in bytecode.c that:

    /* Inline the most common case.  */
    if (SYMBOLP (sym)
&& !EQ (val, Qunbound)
&& *!XSYMBOL (sym)->u.s.redirect*
&& !SYMBOL_TRAPPED_WRITE_P (sym))
      SET_SYMBOL_VAL (XSYMBOL (sym), val);

should be:

    /* Inline the most common case.  */
    if (SYMBOLP (sym)
&& !EQ (val, Qunbound)
&& *XSYMBOL (sym)->u.s.redirect == SYMBOL_PLAINVAL*
&& !SYMBOL_TRAPPED_WRITE_P (sym))
      SET_SYMBOL_VAL (XSYMBOL (sym), val);

As it is, the inline case is never run, since "redirect" is always non-zero.

Since I'm new to emacs internals, I don't know how to benchmark to work out
if this makes a noticable performance difference. :)

Thanks,
Simon.

[-- Attachment #2: Type: text/html, Size: 2136 bytes --]

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

* bug#35562: "varset" bytecode inline path is never taken
  2019-05-04 13:27 bug#35562: "varset" bytecode inline path is never taken Simon Frankau
@ 2019-05-04 16:10 ` Noam Postavsky
  2019-05-04 18:16 ` Paul Eggert
  1 sibling, 0 replies; 3+ messages in thread
From: Noam Postavsky @ 2019-05-04 16:10 UTC (permalink / raw)
  To: Simon Frankau; +Cc: 35562

Simon Frankau <sgf@arbitrary.name> writes:

> While reading the source, I noticed in bytecode.c that:

> && *!XSYMBOL (sym)->u.s.redirect*

> should be:

> && *XSYMBOL (sym)->u.s.redirect == SYMBOL_PLAINVAL*

> As it is, the inline case is never run, since "redirect" is always non-zero.
>
> Since I'm new to emacs internals, I don't know how to benchmark to work out
> if this makes a noticable performance difference. :)

I guess something like this might work (haven't tested to see if
difference is measurable though):

    (defvar bug-35562-test-var nil)
    (benchmark-run-compiled
        (dotimes (_ 1000000)
          ;; Unroll a bit, so that setting `bug-35562-test-var' takes more
          ;; time than incrementing loop counter.
          (setq bug-35562-test-var nil)
          (setq bug-35562-test-var nil)
          (setq bug-35562-test-var nil)
          (setq bug-35562-test-var nil)
          (setq bug-35562-test-var nil)
          (setq bug-35562-test-var nil)
          (setq bug-35562-test-var nil)
          (setq bug-35562-test-var nil)))





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

* bug#35562: "varset" bytecode inline path is never taken
  2019-05-04 13:27 bug#35562: "varset" bytecode inline path is never taken Simon Frankau
  2019-05-04 16:10 ` Noam Postavsky
@ 2019-05-04 18:16 ` Paul Eggert
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggert @ 2019-05-04 18:16 UTC (permalink / raw)
  To: Simon Frankau; +Cc: 35562-done

Thanks for reporting that typo. I verified that the patch improves performance 
significantly (50% speedup) on Noam's benchmark, and installed the patch into 
the Emacs master branch.





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

end of thread, other threads:[~2019-05-04 18:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-04 13:27 bug#35562: "varset" bytecode inline path is never taken Simon Frankau
2019-05-04 16:10 ` Noam Postavsky
2019-05-04 18:16 ` Paul Eggert

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.