develooper Front page | perl.perl5.porters | Postings from October 2001

5.7.2 re's cause perlPod::Text::Overstrike and pod2text -o pod/psed.podto become extreme cpu hogs

Thread Next
From:
David Dyck
Date:
October 22, 2001 12:29
Subject:
5.7.2 re's cause perlPod::Text::Overstrike and pod2text -o pod/psed.podto become extreme cpu hogs
Message ID:
Pine.LNX.4.33.0110221115330.18527-100000@dd.tc.fluke.com

perlbug seems to be loosing (or delaying) posts, so I'm posting directly to p5p


I thought I found an infinite loop when I tried to run
 pod2text -o pod/psed.pod

The =item and following paragraph confuses Pod::Text::Overstrike::wrap()

=item [2addr]B<s/>I<regular expression>B</>I<replacement>B</>I<flags>

The length of the string (121) causes the regular expression
to take an extremely long time to finish

$_ = "[2addr]s\cHs/\cH/_\cHr_\cHe_\cHg_\cHu_\cHl_\cHa_\cHr_\cH _\cHe_\cHx_".
	"\cHp_\cHr_\cHe_\cHs_\cHs_\cHi_\cHo_\cHn/\cH/_\cHr_\cHe_\cHp_\cHl_".
	"\cHa_\cHc_\cHe_\cHm_\cHe_\cHn_\cHt/\cH/_\cHf_\cHl_\cHa_\cHg_\cHs";

/^((?:(?:[^\n]\cH)?[^\n]){0,72})\s+/;


I was going to suggest that since perl-current contains both
  pod2text and pod/psed.pod
I would hope that the re in Pod::Text::Overstrike::wrap()
could be simplified.  (When the length of the string
is 113 the re match takes over 13 minutes on my computer, so
I hope it will finish the whole string by the end of the day :-)

After I discovered that Perl 5.6.0 doesn't exhibit this problem
I really think the perl 're' core should be fixed if
possible.

Thanks,
  David


Summary of my perl5 (revision 5.0 version 7 subversion 2 patch 12508) configuration:
  Platform:
    osname=linux, osvers=2.4.12-ac3, archname=i686-linux
    uname='linux dd 2.4.12-ac3 #2 mon oct 15 15:58:31 pdt 2001 i686 '
    config_args='-Dinstallusrbinperl -Uversiononly -Dusedevel -Doptimize=-O3 -g -de -Dcf_email=dcd@tc.fluke.com'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=define
  Compiler:
    cc='cc', ccflags ='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O3 -g',
    cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='egcs-2.91.66.1 19990314/Linux (egcs-1.1.2 release)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lgdbm -ldbm -ldb -ldl -lm -lc
    perllibs=-ldl -lm -lc
    libc=/lib/libc.so.5.4.44, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: DEBUGGING USE_LARGE_FILES
  Locally applied patches:
  	DEVEL12493
  Built under linux
  Compiled at Oct 19 2001 13:09:54
  @INC:
    /usr/local/lib/perl5/5.7.2/i686-linux
    /usr/local/lib/perl5/5.7.2
    /usr/local/lib/perl5/site_perl/5.7.2/i686-linux
    /usr/local/lib/perl5/site_perl/5.7.2
    /usr/local/lib/perl5/site_perl/5.6.1/i686-linux
    /usr/local/lib/perl5/site_perl/5.6.1
    /usr/local/lib/perl5/site_perl
    .


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About