unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Andreas Röhler" <andreas.roehler@online.de>
Cc: Dmitry Antipov <dmantipov@yandex.ru>, emacs-devel@gnu.org
Subject: Re: [RFC] bytecomp: simple source-level optimization
Date: Mon, 23 Jun 2014 10:19:44 -0400	[thread overview]
Message-ID: <jwvmwd3hfx9.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <53A7EEDE.2050506@online.de> ("Andreas Röhler"'s message of "Mon, 23 Jun 2014 11:09:50 +0200")

>> Source forms like:
>> (if (= (point) (point-min)) ...)
>> or:
>> (if (eq (point-max) (point)) ...)
>> are widely used,
> IMHO a very useful move. However, as this is suboptimal style,
> probably fixing the source --and spread the message-- is better than
> fixing it afterwards.

Indeed, it's very common for compilers to perform optimization of
"silly" expressions like (+ 4 5) or things like that.  The purpose is
not to compensate for the stupidity of the programmer but to eliminate
stupidity introduced by earlier code transformations
(e.g. macro-expansion, inlinling or other optimizations).

If we thing it's undesirable source code, we should add warnings in the
byte-compiler.  If OTOH we think it's perfectly fine source code (saving
the programmer the trouble of remembering the existence and meaning of
bobp/eobp), then it might be worthwhile to add the optimization in the
byte-compiler indeed.


        Stefan



  parent reply	other threads:[~2014-06-23 14:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-23  6:43 [RFC] bytecomp: simple source-level optimization Dmitry Antipov
2014-06-23  8:29 ` Leo Liu
2014-06-23 11:05   ` Dmitry Antipov
2014-06-23 12:26     ` Leo Liu
2014-06-23  9:09 ` Andreas Röhler
2014-06-23 12:44   ` Nicolas Richard
2014-06-23 14:01     ` Andreas Röhler
2014-06-23 14:19   ` Stefan Monnier [this message]
2014-06-23  9:56 ` David Kastrup
2014-06-23 11:40   ` Dmitry Antipov
2014-06-23 11:44     ` Dmitry Antipov
2014-06-25  1:08   ` Stephen J. Turnbull

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=jwvmwd3hfx9.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=andreas.roehler@online.de \
    --cc=dmantipov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    /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).