Having XS code that attempts to deal with even mundane Perl magic is still never something I expect. (Dealing with overloading wasn't something List::Util's XS code even attempted for the first decade of its existence). But, yes, XS code is indeed much, much more likely to be buggy than Perl code. Worse, XS code is much, much more likely to be buggy in ways that you don't notice at first and then cause your code to fail in ways that don't even hint that the XS code is to blame.

But, you know: speed! It is vitally important that your max() function run a fraction of 1ms faster and increasing the code size by an order of magnitude and the code complexity by two orders of magnitude is surely worth all of the time wasted by everybody when it means that a few scripts are running a few ms faster and reducing their total run time by 0.2%.

Every professional software developer knows that "trivially faster code" trumps "correct code" every time.

Me, I tend to care a lot about hidden complexity of code. And so I'm pretty unlikely to use List::Util (especially since v1.23_03: "Dropped the pure-Perl implementation of both Scalar::- and List::Util."). I'll use Perl code because mundane Perl magic gets heavily tested and heavily exercised there and so the odds of me having to dive into the Perl source code because of a bug are much lower.

- tye        


In reply to Re^3: List::Utils can't find max in array of BigInts (XS--) by tye
in thread List::Utils can't find max in array of BigInts by mgatto

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.