Anonymous Monk,
The
oid_lex_sort() function uses the
Schwartzian Transform. Additionally, it uses regular expressions to eliminate leading periods and converts spaces to '.0' globally. If you know none of your OIDs require those regexes then the following might be better.
Benchmarking will say for sure.
my @OID; # defined elsewhere
@OID = @OID[
map { unpack "N", substr($_,-4) }
sort
map { pack('N*', split('\.', $OID[$_])) . pack "N", $_ }
0..$#list
];
It is a straight forward translation to
tye's
one true sort.
Update: Other improvements likely exist but I don't know what constitutes a lexicographical sort of OIDs.