unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Stack-allocated objects again (+benchmark)
@ 2014-09-29  7:09 Dmitry Antipov
  2014-09-30  2:43 ` Paul Eggert
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Antipov @ 2014-09-29  7:09 UTC (permalink / raw)
  To: Emacs development discussions

1) In r117971, I've made an attempt to follow KISS principle and
redesign this stuff for simplicity and speed rather than versatility.

2) I am constantly asked about benchmarks.  OK, running this code:

(defun put-property-benchmark ()
   (interactive)
   (setq buffer-undo-list t)
   (let ((oldgc gcs-done)
         (oldtime (float-time)))
     (while (re-search-forward "[a-f0-9]+" nil t)
       (put-text-property (match-beginning 0) (match-end 0)
			 'face 'font-lock-comment-face))
     (message "GCs: %d Elapsed time: %f seconds"
	     (- gcs-done oldgc) (- (float-time) oldtime))))

through a ~35M dump generated with

od -v -t x2 < glibc-2.19.tar.xz > glibc.txt

shows 55GCs/23.7s with USE_STACK_LISP_OBJECTS and 66GCs/27.9s
without them.  Hopefully this simple benchmark is "real enough".

Dmitry



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

* Re: Stack-allocated objects again (+benchmark)
  2014-09-29  7:09 Stack-allocated objects again (+benchmark) Dmitry Antipov
@ 2014-09-30  2:43 ` Paul Eggert
  2014-09-30  8:25   ` Dmitry Antipov
  2014-09-30 14:05   ` Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Paul Eggert @ 2014-09-30  2:43 UTC (permalink / raw)
  To: Dmitry Antipov, Emacs development discussions

Dmitry Antipov wrote:
> 1) In r117971, I've made an attempt to follow KISS principle and
> redesign this stuff for simplicity and speed rather than versatility.

Thanks for doing that, and for the benchmark.  I found a couple of problems with 
the patch, and thought of some ways to simplify it further and make it more 
portable and a bit faster in many cases, and installed that as trunk bzr 117978. 
  Please have a look when you have the time.



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

* Re: Stack-allocated objects again (+benchmark)
  2014-09-30  2:43 ` Paul Eggert
@ 2014-09-30  8:25   ` Dmitry Antipov
  2014-09-30 20:19     ` Paul Eggert
  2014-09-30 14:05   ` Eli Zaretskii
  1 sibling, 1 reply; 6+ messages in thread
From: Dmitry Antipov @ 2014-09-30  8:25 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Emacs development discussions

On 09/30/2014 06:43 AM, Paul Eggert wrote:

> Thanks for doing that, and for the benchmark.  I found a couple of problems with
>< the patch, and thought of some ways to simplify it further and make it more portable
> and a bit faster in many cases,  and installed that as trunk bzr 117978.  Please have
> a look when you have the time.

1) Thanks, I like an idea with SCOPED_STRING without an extra allocation and memcpy.

2) This snippet from lisp.h:

   4597  /* USE_STACK_LISP_OBJECTS requires GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS.  */
   4598
   4599  #if GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS
   4600  # undef USE_STACK_LISP_OBJECTS
   4601  # define USE_STACK_LISP_OBJECTS false
   4602  #endif

   conflicts with alloc.c:

   72  #if USE_STACK_LISP_OBJECTS
   73  # if GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS
   74  #  error "Stack-allocated Lisp objects are not compatible with GCPROs"
   75  # endif
   76  #endif

   If you prefer 1st (I'm OK with that), 2nd one should be removed.

Dmitry




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

* Re: Stack-allocated objects again (+benchmark)
  2014-09-30  2:43 ` Paul Eggert
  2014-09-30  8:25   ` Dmitry Antipov
@ 2014-09-30 14:05   ` Eli Zaretskii
  2014-09-30 15:37     ` Dmitry Antipov
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2014-09-30 14:05 UTC (permalink / raw)
  To: Paul Eggert; +Cc: dmantipov, emacs-devel

> Date: Mon, 29 Sep 2014 19:43:52 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> 
> Dmitry Antipov wrote:
> > 1) In r117971, I've made an attempt to follow KISS principle and
> > redesign this stuff for simplicity and speed rather than versatility.
> 
> Thanks for doing that, and for the benchmark.  I found a couple of problems with 
> the patch, and thought of some ways to simplify it further and make it more 
> portable and a bit faster in many cases, and installed that as trunk bzr 117978. 

I think it would be beneficial to have some minimal explanations and
instructions wrt when these "scoped" Lisp objects can/should and
cannot/shouldn't be used.  The current commentary doesn't explain
enough about the difference between these "scoped" objects and the
other kind, and I'm not sure we want the future hackers to try to
guess that.

TIA



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

* Re: Stack-allocated objects again (+benchmark)
  2014-09-30 14:05   ` Eli Zaretskii
@ 2014-09-30 15:37     ` Dmitry Antipov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Antipov @ 2014-09-30 15:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Paul Eggert, emacs-devel

On 09/30/2014 06:05 PM, Eli Zaretskii wrote:

> I think it would be beneficial to have some minimal explanations and
> instructions wrt when these "scoped" Lisp objects can/should and
> cannot/shouldn't be used.  The current commentary doesn't explain
> enough about the difference between these "scoped" objects and the
> other kind, and I'm not sure we want the future hackers to try to
> guess that.

Let's try to start from r117987; feel free to add something, make
a suggestion on further improvements and/or just fix English :-).

Dmitry




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

* Re: Stack-allocated objects again (+benchmark)
  2014-09-30  8:25   ` Dmitry Antipov
@ 2014-09-30 20:19     ` Paul Eggert
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Eggert @ 2014-09-30 20:19 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Emacs development discussions

On 09/30/2014 01:25 AM, Dmitry Antipov wrote:
> conflicts with alloc.c: 

Thanks for catching that.  Here I very mildly prefer silently repairing 
the incompatible configuration to complaining and failing to build, so I 
removed the now-unnecessary compile-time test in trunk bzr 117991.



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

end of thread, other threads:[~2014-09-30 20:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-29  7:09 Stack-allocated objects again (+benchmark) Dmitry Antipov
2014-09-30  2:43 ` Paul Eggert
2014-09-30  8:25   ` Dmitry Antipov
2014-09-30 20:19     ` Paul Eggert
2014-09-30 14:05   ` Eli Zaretskii
2014-09-30 15:37     ` Dmitry Antipov

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