Re: How to improve performance of regular expression pattern matching
From: David Marshall (vers_at_nwlink.com)
Date: 12/01/03
- Next message: Kevin Rodgers: "Re: RSH using the Korn Shell."
- Previous message: those who know me have no need of my name: "Re: Convert text in UTF-8"
- Next in thread: John W. Krahn: "Re: How to improve performance of regular expression pattern matching"
- Maybe reply: John W. Krahn: "Re: How to improve performance of regular expression pattern matching"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 1 Dec 2003 14:10:01 -0800
Heiner Steven <heiner.steven@nexgo.de> wrote in message news:<3fc53193$0$20242$9b4e6d93@newsread2.arcor-online.net>...
> David, did you try Ed's suggestion to create one regular
> expression for all of the array elements? I'd be surprised
> if that solution wouldn't be considerably faster.
The reason I used an array of patterns rather than a single pattern
containing all of them is because I will be processing based on which
pattern is matched. So if "John" is matched I would be sending that
line to a file named output.John. So with this requirement I am unable
to use a single pattern.
> We can probably make the script still faster. Currently the
> script checks every element from $Names[] agains each single
> line of the input file. The speed could still improve
> if we found a fast way to find the interesting lines
> (containing one of the search terms), and to ignore the
> others.
>
> This can be done easily by running an "egrep" before
> the line processing:
>
> How fast is the script with this addition?
The reason I did not do this initially is because of the nature of the
file I am parsing. There are not many lines which don't match any
pattern, so the initial egrep only reduces the file size by about 5%.
To answer your question though, it seemed to take about 30 seconds off
of the 10 minute processing time. Not too big of an improvement but
I'll take what I can get.
Thanks for your suggestion,
David
- Next message: Kevin Rodgers: "Re: RSH using the Korn Shell."
- Previous message: those who know me have no need of my name: "Re: Convert text in UTF-8"
- Next in thread: John W. Krahn: "Re: How to improve performance of regular expression pattern matching"
- Maybe reply: John W. Krahn: "Re: How to improve performance of regular expression pattern matching"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|