[Top][All Lists]

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

Re: (*) -> 1

From: Yuri Khan
Subject: Re: (*) -> 1
Date: Thu, 19 Jan 2023 16:41:51 +0700

On Thu, 19 Jan 2023 at 16:18, Jean Louis <> wrote:

> Then I look at the first time it appeared in Emacs:
> Improve arithmetic performance by avoiding bignums until needed.
> (floatop_arith_driver, arith_driver):
> Simplify by assuming NARGS is at least 2.
> All callers changed.

> As I cannot decipher above, does that mean that (*) ➜ 1 was added only
> for reason to speed up some C functions in Emacs?

I understand the above as “before, calculation of 0- and 1-argument
sums and products was handled by the generic implementations in
floatop_arith_driver and arith_driver, but it turned out that
detecting those cases early is cheaper”. If you read the version of
arith_driver prior to this change, you will see the initialization of
the accum variable with an identity value according to the operation,
and then doing the binary operation on accum and each successive
argument and storing the intermediate result back into accum.

The actual logic of (+) and (*) for 0- and 1-argument cases did not
change in that commit. You will have to dig deeper into the history if
you want to find who introduced it first.

reply via email to

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