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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |