There is a measurable, if minor improvement. Which is about what your algorithm offers over mine.

The reason that it is so small is that the connection between size and improvement is not that strong. You only save when you manage to reduce how many "digits" are involved, and at least with Perl 5.6's implementation of Math::BigInt, digits are of size 1e5. Making sure that only a few multiplications have huge numbers is most of what you can save. Multiplying big numbers is a bottleneck. You cannot avoid the bottleneck much more. Next you should speed it up.

If you want to try a pure Perl solution, I suggest implementing Karatsuba multiplication. It isn't nearly as fast as Fourier transforms, but it is easier to understand and implement.


In reply to Re: Re^6: Factorial algorithm execution time by Anonymous Monk
in thread Factorial algorithm execution time by gri6507

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.