in reply to Re^4: Sorting IP addresses, lots of them, quickly
in thread Sorting IP addresses, lots of them, quickly

Great idea.

I wonder, is this sorting routine truly dependant on the regexp mentioned in the documentation (Sort::Key::IPv4), or can be extended to sorting SNMP Object Identifiers (OIDs) which are dotted strings up to any number of elements, e.g.:

1.3.6.1.4.1.2203.1.2.102945.12.0 1.3.6.1.4.1.2203.1.2.102946.1.0 1.3.6.1.2.1.1.2.3.4.5.0

SNMP OIDs are a lot like IPv4 addresses in the way they are sorted, they are represented as dot strings, however unlike IPv4 addresses they can contain an unlimited number of elements and each element can contain an integer of any (non-infinite and non-negative) value.

Replies are listed 'Best First'.
Re^6: Sorting IP addresses, lots of them, quickly
by salva (Canon) on May 21, 2007 at 17:31 UTC
Re^6: Sorting IP addresses, lots of them, quickly
by salva (Canon) on May 17, 2007 at 06:53 UTC
    I wonder, is this sorting routine truly dependant on the regexp mentioned in the documentation

    Yes, it is, because Sort::Key::IPv4 internally converts the IP addresses to 32 bit unsigned integers that can be sorted very fast.

    For OIDs, you can use Sort::Key::Natural that even if it is not going to be as fast as ipv4sort, would probably outperform any other pure perl method.