Subject: | Match variables creating slow down |
Date: | Mon, 21 Mar 2016 16:18:52 +0000 |
To: | "bug-Net-Telnet [...] rt.cpan.org" <bug-Net-Telnet [...] rt.cpan.org> |
From: | "Beitzell, Caton" <Caton.Beitzell [...] spirent.com> |
To whom it may concern,
Using the Net::Telnet package, I have had great results. Recently though I had made changes to my code so that I am retrieving and processing a large amount of data from a telnet connection. I soon found a major slow down. After a bit of troubleshooting I found the culprit was the matching variables in the Telnet.pm file.
Line: 2323
@match_cond =
('if ($s->{buf} =~ ', ') {
$prematch = $`;
$match = $&;
substr($s->{buf}, 0, length($`) + length($&)) = "";
last;
}');
It seems that the excessive slowdown deals with the regex matching I am using and the matching variables. To resolve the issue I changed the Telnet.pm code to read this:
@match_cond =
('if ($s->{buf} =~ ', ') {
$prematch = substr($s->{buf},0, $-[0]);
$match = substr($s->{buf},$-[0], $+[0]-$-[0]);
substr($s->{buf}, 0, length($prematch) + length($match)) = "";
last;
}');
I am using an AIX 6.1 and a Red Hat Linux 7.1 server. I have tested this with both perl v5.6.1 and v5.8.8.
Thank you,
Caton Beitzell
Spirent Communications e-mail confidentiality.
------------------------------------------------------------------------
This e-mail contains confidential and / or privileged information belonging to Spirent Communications plc, its affiliates and / or subsidiaries. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution and / or the taking of any action based upon reliance on the contents of this transmission is strictly forbidden. If you have received this message in error please notify the sender by return e-mail and delete it from your system.
Spirent Communications plc
Northwood Park, Gatwick Road, Crawley, West Sussex, RH10 9XN, United Kingdom.
Tel No. +44 (0) 1293 767676
Fax No. +44 (0) 1293 767677
Registered in England Number 470893
Registered at Northwood Park, Gatwick Road, Crawley, West Sussex, RH10 9XN, United Kingdom.
Or if within the US,
Spirent Communications,
27349 Agoura Road, Calabasas, CA, 91301, USA.
Tel No. 1-818-676- 2300