GNU bug report logs -
#1334
23.0.60; bug of bytecomp arithmetic operations
Previous Next
Full log
Message #46 received at 1334-done <at> emacsbugs.donarmstrong.com (full text, mbox):
>> *** Optimize addtion/subtraction where their last operand is 1 or
>> -1 to use `1+', `1-' funcitons. This pattern often appears and
>> more effective at least in size (byte-add1 vs constant 1).
>
> Let's leave this till after the release. It's not clear to me that
> there is a significant speed increase from it, and we should try to
> restrict the changes to bug fixes for the moment.
I myself was actually irresolute.
But, at least, for three operands I think it it worths
optimizing. For more than three operands, only expectation of
save of storage(for constant 1), and probability of the later
re-optimization induced by decresing of the number of operands.
(+ a b 1)
no optimization optimazation
0 constant + varref a
1 varref a varref b
2 varref b plus
3 constant 1 add1
4 call 3 return
5 return
(+ a b c 1)
0 constant + constant +
1 varref a varref a
2 varref b varref b
3 varref c varref c
4 constant 1 call 3
5 call 4 add1
6 return return
(byte-compile (lambda () (+ a b c 1)))
#[nil "\303\b\t\n\304$\207" [a b c + 1] 5]
#[nil "\303\b\t\n#T\207" [a b c +] 4]
Anyway, please do what you think is best now.
Regards,
Shigeru
2008/11/22 Chong Yidong <cyd <at> stupidchicken.com>:
> I've reviewed your patch, and checked most of it into CVS (I took the
> liberty of rewording some comments, plus some minor edits).
>
>> *** Optimize addtion/subtraction where their last operand is 1 or
>> -1 to use `1+', `1-' funcitons. This pattern often appears and
>> more effective at least in size (byte-add1 vs constant 1).
>
> Let's leave this till after the release. It's not clear to me that
> there is a significant speed increase from it, and we should try to
> restrict the changes to bug fixes for the moment.
>
> Thanks very much for working on this.
>
This bug report was last modified 16 years and 233 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.