in reply to Fast file parsing
You should make sure that the most common situations are the ones that come first in that list of || conditions. Also, for large files it can be helpful to read in chunks bigger than one line. I found this node sped things up a lot when I was doing something similar.# Only care about comments next unless ( index( $_, '%%' ) == 0 ); # Duplex or no... if (( index( $_, '%%' ) == 0 && index( $_, 'Duplex Duplex' > -1 )) || /^[&l1S/i || /^[&l2S/i || index( $_, 'DUPLEX=ON') > -1 ) { $pagestate = 'Duplex'; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Fast file parsing
by hv (Prior) on Mar 09, 2004 at 17:43 UTC | |
by perrin (Chancellor) on Mar 09, 2004 at 18:15 UTC |