in reply to Re^2: sort routines crossing package lines
in thread sort routines crossing package lines

I ran this on my machine -- a Dell Precision 340 running Fedora 2.6.something, Perl 5.8.4 --, fixing the arg(s)less problems and giving it a more hefty list to sort (~2500 items). My results from three runs:
Rate proto argsless inline args proto 189740/s -- -0% -31% -32% argsless 190421/s 0% -- -30% -32% inline 273132/s 44% 43% -- -3% args 280139/s 48% 47% 3% -- Rate argsless proto inline args argsless 188543/s -- -0% -31% -33% proto 188746/s 0% -- -31% -33% inline 273988/s 45% 45% -- -3% args 281040/s 49% 49% 3% -- Rate proto argsless inline args proto 191010/s -- -1% -27% -30% argsless 192801/s 1% -- -27% -30% inline 262320/s 37% 36% -- -4% args 274019/s 43% 42% 4% --
I'm not terribly surprised that inline is faster than the other named sub methods, but am quite surprsied that the 'args' version is the fastest.

Update: Okay, adding an assignment in the benchmarked code gives more sensible results:

Rate args proto argsless inline args 17.5/s -- -45% -49% -51% proto 31.8/s 82% -- -8% -11% argsless 34.6/s 98% 9% -- -3% inline 35.5/s 103% 12% 3% -- Rate args proto argsless inline args 17.3/s -- -46% -51% -52% proto 32.0/s 85% -- -9% -11% argsless 35.1/s 103% 10% -- -2% inline 35.7/s 107% 12% 2% -- Rate args proto inline argsless args 17.4/s -- -47% -49% -50% proto 33.0/s 90% -- -4% -5% inline 34.4/s 97% 4% -- -1% argsless 34.8/s 100% 5% 1% --
--DrWhy

"If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."