On 03/26, Jenda Krynicky said something like:
> From: "Jonathan E. Paton" <[EMAIL PROTECTED]>
> > > affect the performance of:
> > > key listings (things like grep /pattern/, keys %hash)
> >
> > Grep can be slow, especially with patterns. Keys
> > could be slow, especially if the dataset is large.
>
> Maybe you could try to use
>
> while (my ($key) = each %hash) {
> next unless $key =~ /pattern/
> ... do whatever you need
> }
Hmm. I used grep thinking it would be fast. I'll try iterating the keys
and having a good simple regex, too.
The dataset is a few branches of a router's SNMP tree. Particularly,
ipAdEntIfIndex interfaces.ifTable.ifEntry.ifDescr cbQosServicePolicy
cbQosObjectsEntry cbQosCMStatsEntry cbQosPolicyMapName &
cbQosCMCfgTable. The textual OID is the key, and value == value.
First I want to profile, though... See what the actual improvement
factor is for the changed lines of code...
--
Shawn Leas
[EMAIL PROTECTED]
I didn't get a toy train like the other kids, I got
a toy subway instead; you couldn't see anything but
every now and then you'd hear this rumbling noise go by.
-- Stephen Wright
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]