unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Vinicius Jose Latorre <viniciusjl@ig.com.br>
Cc: emacs-devel@gnu.org
Subject: Re: printing.el again
Date: Thu, 18 Nov 2004 20:44:21 -0200	[thread overview]
Message-ID: <419D25C5.8080303@ig.com.br> (raw)
In-Reply-To: <jwvvfc3rumx.fsf-monnier+emacs@gnu.org>

 > > Well, I think it's important to know the optimizations we can use 
or not
 > > and when.
 >
 > I don't understand.  *You* can't use an optimization: the 
byte-compiler can.

Rephrasing:

Well, I think it's important to know the optimizations we can SET or not and
when.

Like when you use gcc:

   gcc -O3

You set above optimization level 3.

Did you understand?


 > > That is, if I have a code which test (featurep 'some-package) and
 > > some-package is not loaded, does the byte-compiler eliminate the code
 > > associated with this test?
 >
 > Think of it this way: any optimization should be "semantics 
preserving" and
 > should thus only affect the CPU and memory usage but not the 
beavior.  So if
 > you can think of a case where an optimization induces a different 
behavior,
 > there are 3 possibilities:
 > 1 - this case is really outlandish and can be itself considered a bug
 >     (e.g. someone does (provide 'xemacs)).
 > 2 - the case is a real problem and thus the byte-compiler does not 
use this
 >     optimization.
 > 3 - the case is a real problem but the compiler does use the 
optimization,
 >     in which case you have uncovered a byte-compiler bug and you should
 >     report it.

Consider the following code:

(defun foo (arg)
   (if (featurep 'someone-package)
      (behavior-A)
    (behavior-B)))

Does the byte-compiler "optimize" the code above?

(featurep 'xemacs) is ok, because you are saying in which system all 
packages
will run.  But if you write a code to have a behavior depending on the 
packages
that are loaded in a given moment, maybe it's not ok.

So, if someone-package is not loaded, the foo is byte-compiled and the
"featurep optimization" is done, the result is:

(defun foo (arg)
  (behavior-B))

If someone-package is loaded later, then the code above will not execute as
behavior-A.

So, "featurep optimization" in general is not good.  But (featurep 'xemacs)
optimization is good.


Vinicius

  reply	other threads:[~2004-11-18 22:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-14  5:59 printing.el again Stefan
2004-11-14 15:29 ` Vinicius Jose Latorre
2004-11-14 19:20   ` Stefan Monnier
2004-11-15 20:03     ` Vinicius Jose Latorre
2004-11-15 20:47       ` Stefan Monnier
2004-11-16  0:55         ` Vinicius Jose Latorre
2004-11-16  1:29           ` Stefan
2004-11-16  1:36             ` Luc Teirlinck
2004-11-16 14:47             ` Ralf Angeli
2004-11-16 16:51               ` Stefan Monnier
2004-11-18  1:53             ` Vinicius Jose Latorre
2004-11-18 16:30               ` Stefan Monnier
2004-11-18 22:44                 ` Vinicius Jose Latorre [this message]
2004-11-18 23:31                   ` Stefan Monnier
2004-11-19 20:04                   ` Richard Stallman
2004-11-17  5:03       ` Richard Stallman

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=419D25C5.8080303@ig.com.br \
    --to=viniciusjl@ig.com.br \
    --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).