Efficient sorting of SNMP oids

Uri Guttman uri at StemSystems.com
Sat Oct 31 19:11:23 GMT 2009

>>>>> "BM" == B Maqueira <bmi at ferrarihaines.com> writes:

  BM> Dear all,
  BM> I need to sort eficiently a large array (~9000) of SNMP OIDs.

  BM> I am currently trying the following code:

  BM> my @sorted_oids = map { $_->[0] }
  BM>                                   sort { $a->[1] cmp $b->[1] }
  BM>                                      map { [$_, pack('w*', split(/\./,
  BM> $_))]  } @oids;

  BM> But this fails since it outputs before
  BM> than

sort::maker could do that and generate a faster sort with the GRT. just
generate an array of integers (or shorts) and pack them for the
key. similar to what you have there.


Uri Guttman  ------  uri at stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

More information about the london.pm mailing list