[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] bytecomp: simple source-level optimization

From: Stefan Monnier
Subject: Re: [RFC] bytecomp: simple source-level optimization
Date: Mon, 23 Jun 2014 10:19:44 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

>> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]