Re: Speedup of regexp required for Tcl-Scanner
- From: "Dr. Detlef Groth" <dgroth@xxxxxx>
- Date: Tue, 29 Apr 2008 07:15:40 -0700 (PDT)
Whatever. It's not clear whether you are requesting assistance for
optimization of your regexps or trying to draw attention to an
unexpected algorithmic worst case.
In any case, from a macroscopic look, I have the impression that
you're trying to reimplement line-oriented prefix parsing (considering
the frequency of ^ and \n in your regexp) within an awkward block-
based parsing loop. I'd suggest instead:
while {[gets stdin line]>=0} {
switch -regexp -- $line {
{^Someprefix} {...}
...
}
}
-Alex
I can't use line based parsing with switch, as I might catch two
different regexp on the same line. Anyway with some ideas gathered
here we get a performance boost from about 50 seconds to one or two
seconds for a 5Mb file. The principle idea is to find a template where
a Flex-like input file can't be used to fill this to generate a
scanner.
regards,
detlef
.
- Follow-Ups:
- Re: Speedup of regexp required for Tcl-Scanner
- From: Alexandre Ferrieux
- Re: Speedup of regexp required for Tcl-Scanner
- References:
- Speedup of regexp required for Tcl-Scanner
- From: Dr. Detlef Groth
- Re: Speedup of regexp required for Tcl-Scanner
- From: EL
- Re: Speedup of regexp required for Tcl-Scanner
- From: Dr. Detlef Groth
- Re: Speedup of regexp required for Tcl-Scanner
- From: Alexandre Ferrieux
- Re: Speedup of regexp required for Tcl-Scanner
- From: Dr. Detlef Groth
- Re: Speedup of regexp required for Tcl-Scanner
- From: Alexandre Ferrieux
- Re: Speedup of regexp required for Tcl-Scanner
- From: Dr. Detlef Groth
- Re: Speedup of regexp required for Tcl-Scanner
- From: Alexandre Ferrieux
- Speedup of regexp required for Tcl-Scanner
- Prev by Date: Re: Speedup of regexp required for Tcl-Scanner
- Next by Date: Re: how to parse xml values
- Previous by thread: Re: Speedup of regexp required for Tcl-Scanner
- Next by thread: Re: Speedup of regexp required for Tcl-Scanner
- Index(es):
Relevant Pages
|