Got a huge pile of IP addresses to sort and don't have all day to do it?

Update This is just a variation on the GRT, really, but it's a tad faster than the one in their paper.

use Socket; sub gloryhackish { my @in = @addresses; my @sorted = map { $_ = inet_ntoa($_) } (sort (map {$_ = inet_aton($_)} @in)); return @sorted; } __END__ Testing with 11818 addresses from my local blacklist: Benchmark: running gloryhackish, grt, schwartzian for at least 10 CPU +seconds... gloryhackish: 11 wallclock secs (10.50 usr + 0.06 sys = 10.56 CPU) @ +22.25/s (n=235) grt: 11 wallclock secs (10.57 usr + 0.03 sys = 10.60 CPU) @ 16.32/s ( +n=173) schwartzian: 11 wallclock secs (11.02 usr + 0.02 sys = 11.04 CPU) @ +8.42/s (n=93) Rate schwartzian grt gloryhackish schwartzian 8.42/s -- -48% -62% grt 16.3/s 94% -- -27% gloryhackish 22.3/s 164% 36% --

In reply to Sorting IP addresses, lots of them, quickly by gloryhack

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.