From: Dmitry Antipov <dmantipov@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>,
Paul Eggert <eggert@cs.ucla.edu>
Cc: Emacs development discussions <emacs-devel@gnu.org>
Subject: Re: Benchmarking temporary Lisp objects [Was: Re: [RFC] temporary Lisp_Strings]
Date: Mon, 08 Sep 2014 14:33:07 +0400 [thread overview]
Message-ID: <540D85E3.5090407@yandex.ru> (raw)
In-Reply-To: <jwvoauucckm.fsf-monnier+emacs@gnu.org>
On 09/05/2014 07:35 PM, Stefan Monnier wrote:
> I'd expect that such escaping would only occur in "unusual setups", as
> a result of later unrelated changes. E.g. an alloca_string object is
> passed to DECODE_FILE or to Fexpand_file_name, which will usually stay
> within C code or even if it escapes to Elisp its lifetime will not
> escape the stack discipline.
>
> And some times later we get random crashes in odd situations because
> someone figure a clever way to do god-knows-what (e.g. speed things up
> via a memoization) by storing those refs into some global table.
Surely such an errors are possible. But if we use alloca in general,
there is always a possibility for someone to misuse pointer returned
from it, no matter whether that pointer is used for Lisp_Objects or not.
Any developer good enough in C should be able to find, track and fix
this class of errors, so I don't see a problem here.
> Basically, this risks making Elisp's semantics more murky, so it has to
> come with a good performance story.
In somewhat corner cases where an allocation speed is really important,
we can get a very good story. For example, using build_local_vector
instead of Fmake_vector in Ffind_charset_region makes this function ~18x
times faster (for reatively large buffers):
(defun test-charset ()
(interactive)
(let ((start (float-time))
(max (1- (buffer-size))))
(dotimes (i max) (find-charset-region (1+ max) (+ max 2)))
(message "%fs elapsed" (- (float-time) start))))
Of course, no one should detect charsets by scanning buffer in such a way,
but I found this example very illustrative. And I believe that no one can
design an example where using alloca introduces a 18x slowdown :-).
Dmitry
next prev parent reply other threads:[~2014-09-08 10:33 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-02 12:55 [RFC] temporary Lisp_Strings Dmitry Antipov
2014-09-02 13:21 ` Andreas Schwab
2014-09-02 13:47 ` Dmitry Antipov
2014-09-02 14:14 ` Andreas Schwab
2014-09-02 15:00 ` Eli Zaretskii
2014-09-02 14:00 ` Stefan Monnier
2014-09-02 15:13 ` Dmitry Antipov
2014-09-02 17:32 ` Stefan Monnier
2014-09-03 10:23 ` Benchmarking temporary Lisp objects [Was: Re: [RFC] temporary Lisp_Strings] Dmitry Antipov
2014-09-03 13:14 ` Stefan Monnier
2014-09-03 14:39 ` Paul Eggert
2014-09-03 15:39 ` Dmitry Antipov
2014-09-03 16:42 ` Paul Eggert
2014-09-03 17:47 ` Stefan Monnier
2014-09-03 18:00 ` Paul Eggert
2014-09-04 4:59 ` Dmitry Antipov
2014-09-04 5:13 ` Paul Eggert
2014-09-04 5:51 ` Dmitry Antipov
2014-09-04 6:45 ` Paul Eggert
2014-09-04 13:11 ` Stefan Monnier
2014-09-04 13:37 ` Dmitry Antipov
2014-09-04 14:46 ` Dmitry Antipov
2014-09-04 16:03 ` Paul Eggert
2014-09-05 4:00 ` Dmitry Antipov
2014-09-05 4:24 ` Stefan Monnier
2014-09-05 9:28 ` Dmitry Antipov
2014-09-05 7:15 ` Paul Eggert
2014-09-05 9:16 ` Dmitry Antipov
2014-09-05 14:35 ` Paul Eggert
2014-09-05 15:35 ` Stefan Monnier
2014-09-08 10:33 ` Dmitry Antipov [this message]
2014-09-08 12:01 ` Dmitry Antipov
2014-09-08 13:30 ` Stefan Monnier
2014-09-08 12:44 ` Stefan Monnier
2014-09-08 13:30 ` Stefan Monnier
2014-09-02 14:37 ` [RFC] temporary Lisp_Strings Paul Eggert
2014-09-02 15:24 ` Dmitry Antipov
2014-09-02 15:28 ` Dmitry Antipov
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=540D85E3.5090407@yandex.ru \
--to=dmantipov@yandex.ru \
--cc=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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 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.