From: Eli Zaretskii <eliz@gnu.org>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: eggert@cs.ucla.edu, monnier@IRO.UMontreal.CA, emacs-devel@gnu.org
Subject: Re: Optimize assume(...) away? (agaiin)
Date: Wed, 09 Oct 2013 20:21:21 +0300 [thread overview]
Message-ID: <83d2neqs1a.fsf@gnu.org> (raw)
In-Reply-To: <525587A5.3040101@yandex.ru>
> Date: Wed, 09 Oct 2013 20:43:17 +0400
> From: Dmitry Antipov <dmantipov@yandex.ru>
> CC: Stefan Monnier <monnier@IRO.UMontreal.CA>,
> Eli Zaretskii <eliz@gnu.org>,
> Paul Eggert <eggert@cs.ucla.edu>
>
> 1) http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00238.html
> 2) http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15565
>
> 3) Consider non-trivial eassert like:
>
> eassert ((BUFFERP (it->object)
> && IT_CHARPOS (*it) == it->bidi_it.charpos
> && IT_BYTEPOS (*it) == it->bidi_it.bytepos)
> || (STRINGP (it->object)
> && IT_STRING_CHARPOS (*it) == it->bidi_it.charpos
> && IT_STRING_BYTEPOS (*it) == it->bidi_it.bytepos)
> || (CONSP (it->object) && it->method == GET_FROM_STRETCH))
>
> a) It takes some time to check whether there are side effects here;
> b) If someone change 'struct it' so IT_STRING_CHARPOS (*it)
> becomes a non-trivial function with side effects, it would be
> too annoying (and error-prone) to review all easserts.
>
> Due to 1), 2) and 3) I strongly suggests to redesign eassert
> to avoid any assumptions about its argument expression.
How about simply removing 'assume' from eassert?
'assume' is primarily an optimization device, and thus important in
production builds of Emacs where optimizations are enabled. By
contrast, eassert will be defined to nothing in such builds. So it
sounds like we are at best optimizing a rare, or even non-existing use
case, a.k.a. "premature optimization".
next prev parent reply other threads:[~2013-10-09 17:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-09 16:43 Optimize assume(...) away? (agaiin) Dmitry Antipov
2013-10-09 17:21 ` Eli Zaretskii [this message]
2013-10-09 17:55 ` Paul Eggert
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=83d2neqs1a.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=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.