$Bill Luebkert wrote:
Steve Dawson wrote:
On a 6MB test file, The regex ran in 2.48secs while my split ran in 6.19secs. Here's the variations I tried and the timings...

1) My version of the split: *6.19s* @columns = split /\"\s+\"/

This one is faster than below, but doesn't handle field 1 and n.
You could also use something like: split /\s*("[^"]+")\s*/   untested.
And toss every other field (even fields).
Yeah, saw what you were trying to do with the variant match. I was figuring that for a 10GB file, it might be faster to get a rougher match on the line and then reprocess the whole line . The match that collected all of the fields cleanly ran 50% slower.

I see what you mean about field 1 and n. I would have got them but just with an extra " at the start of field and at the end of field-n. I'll take the speed over finesse defence on that.

I could also have grabbed the quotes on all the fields with: split /(?<=")\s+(?=")/ that one runs in 6.4 secs.

Cheers

Steve

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to