unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Daniel Colascione <dancol@dancol.org>
Cc: Philipp Stephani <p.stephani2@gmail.com>,
	Paul Eggert <eggert@cs.ucla.edu>,
	emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] emacs-25 3eb93c0: Rely on conservative stack scanning to find "emacs_value"s
Date: Fri, 01 Apr 2016 15:05:40 -0400	[thread overview]
Message-ID: <jwvio01qi7a.fsf-monnier+emacsdiffs@gnu.org> (raw)
In-Reply-To: <56FEBF28.40900@dancol.org> (Daniel Colascione's message of "Fri,  1 Apr 2016 11:34:16 -0700")

>>> That's cheap: you can do it with linear allocation out of an array.
>>> Why would that be expensive?
>> That's very expensive compared to doing nothing.
>> It means that you have to allocate a new array, 
> Once.

No, what I describe is what happens every single time you go from one
side of the fence to the other (i.e. when Elisp calls to an external
module, as well as every time that external module does a funcall to an
Elisp function).

>> loop through the old one calling your "cheap allocation" function on
>> each element, instead of just passing the array pointer untouched.
> It's a pointer comparison of something that will be in L1 cache anyway.

What pointer comparison?  I'm talking about an allocation of an
array (one element per argument of the function being called) plus
a loop through this array.

> Of course it's slower than doing nothing. But you have not demonstrated
> that it is meaningfully slower,

We're talking about the building blocks of a language construct.

There's no reason why a funcall from a module to an Elisp function (or
vice versa) should be significantly slower than if it were implemented
"in core".

Currently we're still pretty far from this ideal, because of the
signal-catching (which additionally forces us to allocate+fill+pass
a whole new "struct emacs_env_25" every time, instead of passing it once
and for all when opening the module).

Using "Lisp_Object = emacs_value" lets us get a bit closer to
this ideal, tho.

> meanwhile, you're ignoring the compatibility benefits and consigning
> everyone to stack scanning forever.

I don't foresee any disappearance of stack-scanning in the next ten
years.  And any such disappearance if it ever happens will have much
further reaching consequences on Emacs's C code, so we'll be *thrilled*
to break backward compatibility for external modules at that point.


        Stefan



  reply	other threads:[~2016-04-01 19:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20151130193446.22218.14685@vcs.savannah.gnu.org>
     [not found] ` <E1a3UDm-0005my-HI@vcs.savannah.gnu.org>
2016-01-03 13:59   ` [Emacs-diffs] emacs-25 3eb93c0: Rely on conservative stack scanning to find "emacs_value"s Daniel Colascione
2016-01-03 15:45     ` Paul Eggert
2016-03-29 10:07       ` Philipp Stephani
2016-03-29 12:59         ` Stefan Monnier
2016-03-30  1:35         ` Paul Eggert
2016-03-30 18:26           ` Philipp Stephani
2016-03-30 18:28             ` Daniel Colascione
2016-03-30 18:42             ` Paul Eggert
2016-03-30 18:48               ` Daniel Colascione
2016-03-30 21:13             ` Stefan Monnier
2016-03-30 21:18               ` Daniel Colascione
2016-03-30 21:30                 ` Stefan Monnier
2016-03-31 18:46                   ` Philipp Stephani
2016-03-31 19:24                   ` Daniel Colascione
2016-03-31 21:29                     ` Stefan Monnier
2016-04-01 18:34                       ` Daniel Colascione
2016-04-01 19:05                         ` Stefan Monnier [this message]
2016-04-01 19:15                           ` Daniel Colascione
2016-04-01 22:46                             ` Stefan Monnier
2016-04-03  1:11                               ` Daniel Colascione
2016-04-03  5:49                                 ` Stefan Monnier

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=jwvio01qi7a.fsf-monnier+emacsdiffs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=dancol@dancol.org \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=p.stephani2@gmail.com \
    /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).