micro optimisation of this sort can usually be beaten by either getting faster hardware or improving algorithms. You may be interested in Youtube - Matt Parker: Someone improved my code by 40,832,277,770% to see the extreme version of this comment!

Spot on Gramps, especially improving algorithms! If you don't do that, your carefully micro optimized code will likely end up as a fast slow program.

While your cited example of improving the running time from 32 days down to 0.006761 seconds is certainly extreme, it didn't really surprise me, after years (off and on) of becoming obsessed with performance challenges.

As documented in gory detail here (see The 10**21 Problem links), I remember gasping in disbelief a few years back when, obsessively working alone, I eventually coaxed some complex code into running 50 million times faster. IIRC, it took me about a year and I remember being constantly surprised when one insight led to another ... and another ... and another. When you open up performance challenges to fierce competition (especially if marioroy is involved) expect astonishing things to happen. :-)

👁️🍾👍🦟

In reply to Re^2: "my" cost by eyepopslikeamosquito
in thread "my" cost by Danny

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.