Joerg Sonnenberger wrote in
 <yotyoddlj4yqv...@bec.de>:
 |Am Wed, May 18, 2022 at 12:49:21PM +0200 schrieb Steffen Nurpmeso:
 |> What surprised me was that the Apple code requires more calls, and
 |> that today divisions and multiplications still matter.  I think it
 |> was the Cyrix 166+ (or was it Athlon 1600+) where +,-,<<,>> was
 |> one cycle, * was ten cycles, and %,/ was fourty cycles.  But
 |> i think the Core i5 8th Gen that i have requires one cycle for all
 |> of them.
 |
 |I dare you to find any CPU optimized for speed where division and modulo
 |are as fast as multiplication. What you have nowadays is a single cycle
 |for basic operations like additions and shifts, about three cycles for
 |multiplications (on x86 at least) and an order of magnitude more for
 |division. That's not really surprising either if you consider that

Thanks.  I really had not looked since about 2005.  (In fact
i never really looked, i think a c't magazine CD once came over
with x86 interrupt lists, CPU cycle usage, and a (sketchy) RFC
collection.)  Hm, it even seems the number of cycles increased for
division .. i do not know which numbers i had seen by then, did
they include cache work at all?  Well.  So this was that.

 |integer multiplication has a fast circuit implementation where as
 |division is often implemented as cascading conditional subtraction.
 |The difference matters enough turning the reminder operation in the ELF
 |hash into essentially (x - x * (1/size) * size) give a 2% speed up for a
 |large application like Firefox ten years ago.

Interesting.  Well you live in pkgsrc with all the mess that all
those huge software suites introduce, whereas i still "jerk" if
i produce software which needs more than EXEC (/ RODATA) and BSS,
and "shudder" for all the CTOR and DTOR and TLS (but ok: cool) and
all the other stuff that is found in ELF, and handled by the
linker.  (I have ELF v1.2 and TLS-ABI, and even glanced over them
a really long time ago though.  But you know, it is so far off!
And it makes no fun thinking about that :))

 |Joerg
 --End of <yotyoddlj4yqv...@bec.de>

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

Reply via email to