I'm seeing what appears to be a hardware dependence, too. On an old dual P-II/450 with 1G of RAM, I get (with my original 11818 address list):
Rate ukeysort grt schwartzian gloryhackish
+ keysort
ukeysort 1.63/s -- -20% -21% -39%
+ -70%
grt 2.04/s 25% -- -0% -23%
+ -62%
schwartzian 2.05/s 26% 0% -- -23%
+ -62%
gloryhackish 2.66/s 63% 30% 30% --
+ -51%
keysort 5.41/s 232% 165% 163% 103%
+ --
Somehow, ukeysort went to the back of the line, with GRT not being a whole lot zippier and inconsequentially slower than ST. On a similar machine with just a single P-II/500 and 640M of RAM, though:
Rate schwartzian ukeysort grt gloryhackish
+ keysort
schwartzian 2.28/s -- -22% -27% -42%
+ -71%
ukeysort 2.92/s 28% -- -7% -25%
+ -63%
grt 3.14/s 38% 8% -- -20%
+ -60%
gloryhackish 3.91/s 72% 34% 25% --
+ -50%
keysort 7.86/s 245% 169% 151% 101%
+ --
GRT beats ukeysort again and is well ahead of ST. But on an Athlon 3900+ w/1G RAM:
Rate schwartzian grt ukeysort gloryhackish
+ keysort
schwartzian 6.83/s -- -37% -46% -52%
+ -76%
grt 10.9/s 59% -- -13% -24%
+ -61%
ukeysort 12.6/s 84% 16% -- -12%
+ -55%
gloryhackish 14.2/s 108% 31% 13% --
+ -50%
keysort 28.2/s 312% 159% 124% 98%
+ --
None of these machines are memory constrained, none are swapping, and none are particularly busy doing other things. All are running the same version of Debian with the stock kernels, running the exact same test code just copied from machine to machine. keysort is always out front, but unlike my AMD64 the gloryhackish stays in the #2 spot every time, while the others wiggle around depending upon the machine used.
'Tis a puzzle, seems to point toward something at a very low level being the source of the disparate numbers. The only conclusion I can come up with is that keysort is the way to go when a large number of IP addresses must be sorted in a time constrained environment, gloryhackish might be a good choice if no non-core module dependencies are allowed, even though it might not always be the second best choice. It's good to know about Sort::Key, in any event. |