Thread overview
[Issue 16200] Faster pow implementation for integral exponents
Jul 02, 2017
Vladimir Panteleev
Feb 02, 2021
Berni44
Feb 03, 2021
Berni44
Mar 01, 2021
Dlang Bot
Mar 09, 2021
Dlang Bot
July 02, 2017
https://issues.dlang.org/show_bug.cgi?id=16200

Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dlang-bugzilla@thecybershad
                   |                            |ow.net
          Component|dmd                         |phobos
           Hardware|x86_64                      |All
                 OS|Linux                       |All

--- Comment #1 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
(In reply to Andrei Alexandrescu from comment #0)
> Stepanov discusses

(to clarify, that's Alex Stepanov, not related to D contributor Igor Stepanov)

--
February 02, 2021
https://issues.dlang.org/show_bug.cgi?id=16200

Berni44 <bugzilla@bernis-buecher.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@bernis-buecher.de

--- Comment #2 from Berni44 <bugzilla@bernis-buecher.de> ---
Results on my computer:

dmd:
0 1 sec, 331 ms, 327 μs, and 6 hnsecs
1 2 secs, 940 ms, 293 μs, and 9 hnsecs
2 7 secs, 428 ms, 953 μs, and 5 hnsecs

ldc:
0 330 ms, 3 μs, and 2 hnsecs
1 117 ms, 824 μs, and 1 hnsec
2 1 sec, 324 ms, 530 μs, and 6 hnsecs

IMHO the program compares apples with oranges, that is doubles with reals. Replacing double with real I get:

dmd:
0 2 secs, 335 ms, 325 μs, and 8 hnsecs
1 2 secs, 942 ms, 572 μs, and 9 hnsecs
2 7 secs, 421 ms, 349 μs, and 3 hnsecs

ldc:
0 530 ms, 947 μs, and 1 hnsec
1 117 ms, 768 μs, and 1 hnsec
2 1 sec, 324 ms, 124 μs, and 9 hnsecs

Not so clear, that the new algorithm is superior...

(I did a lot of more speed checking with these algorithms - I will write the results down and post a link here, once I'm done.)

See also https://github.com/dlang/phobos/pull/7783 for results on checking correctness.

--
February 03, 2021
https://issues.dlang.org/show_bug.cgi?id=16200

--- Comment #3 from Berni44 <bugzilla@bernis-buecher.de> ---
Created attachment 1815
  --> https://issues.dlang.org/attachment.cgi?id=1815&action=edit
Some analysis on speed differences between the three algorithms in charge

I added now an attachment with a speed analysis of the three algorithms (stepanovs is not identical to the one given above). Main result: None of the three algorithms is clearly better than the others. (But there are nice diagrams and an other idea on how to improve the speed of the pow function.)

--
March 01, 2021
https://issues.dlang.org/show_bug.cgi?id=16200

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@berni44 created dlang/phobos pull request #7823 "Fix Issue 16200 - Faster pow implementation for integral exponents" fixing this issue:

- Fix Issue 16200 - Faster pow implementation for integral exponents

https://github.com/dlang/phobos/pull/7823

--
March 09, 2021
https://issues.dlang.org/show_bug.cgi?id=16200

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/phobos pull request #7823 "Fix Issue 16200 - Faster pow implementation for integral exponents" was merged into master:

- 1c5ab751434f9c7f2c8be786129cbdd4ad19e98d by berni44:
  Fix Issue 16200 - Faster pow implementation for integral exponents

https://github.com/dlang/phobos/pull/7823

--