To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.off-topic.geekOpen lugnet.off-topic.geek in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Off-Topic / Geek / 2500
2499  |  2501
Subject: 
Re: Perl5 regexen: exponential backtracking behavior when mixing \n and \s
Newsgroups: 
lugnet.off-topic.geek
Date: 
Sun, 17 Dec 2000 03:29:26 GMT
Viewed: 
55 times
  
Todd Lehman wrote:

Anyone out there running Perl 5.6 or higher?  Try running this little test
proggy that compares the approximate CPU execution times of two regexen:

[lindsey@wolrab ~]$ uname -a
Linux wolrab 2.2.16-22smp #1 SMP Tue Aug 22 16:39:21 EDT 2000 i686 unknown
[lindsey@wolrab ~]$ cat /etc/redhat-release
Red Hat Linux release 7.0 (Guinness)

s/(?:\n[ \t]*)+$//
0 0.00
1 0.00
2 0.00
3 0.00
4 0.00
5 0.00
6 0.00
7 0.00
8 0.00
9 0.00
10 0.00
11 0.00
12 0.00
13 0.00
14 0.00
15 0.00
16 0.00
17 0.00
18 0.00
19 0.00
20 0.00
21 0.00
22 0.00

s/(?:\n\s*)+$//
0 0.00
1 0.00
2 0.00
3 0.00
4 0.00
5 0.00
6 0.00
7 0.00
8 0.00
9 0.00
10 0.00
11 0.00
12 0.00
13 0.00
14 0.00
15 0.00
16 0.00
17 0.00
18 0.00
19 0.00
20 0.00
21 0.00
22 0.00

Chris



Message has 1 Reply:
  Re: Perl5 regexen: exponential backtracking behavior when mixing \n and \s
 
(...) Awesome. Was that Perl 5.6? So it's smart enough to compile \n\s into a DFA instead of an NDFA? Wow. --Todd (24 years ago, 17-Dec-00, to lugnet.off-topic.geek)

Message is in Reply To:
  Perl5 regexen: exponential backtracking behavior when mixing \n and \s
 
Anyone out there running Perl 5.6 or higher? Try running this little test proggy that compares the approximate CPU execution times of two regexen: ---...---begin---...--- #!/bin/perl use strict; $^W = 1; sub cputime { my ($user, $sys, $cuser, $csys) (...) (24 years ago, 17-Dec-00, to lugnet.off-topic.geek)

5 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR