in reply to From one beginner to others . . .

While your point is flawlessly made, I'm curious about one thing: Did you go back and re-run the program using split? If the file gets cached, you may be seeing artificial improvements. This is where the BenchMark.pm module can really help in a comparison like this.

Without seeing your data, I imagine you'd take one line that matched your criteria, and one that didn't. Then write a comparison using both a passing and failing case with your data, duplicated to use split one way, and the regexp the other. This eliminates the file system as a possible source of artificial improvements.

There was a dicussion about whether split was faster than a regexp or not, rather recently. I don't recall the outcome, but that node may be worth hunting up.

--Chris

e-mail jcwren
  • Comment on (jcwren) RE: From one beginner to others . . .

Replies are listed 'Best First'.
RE: (jcwren) RE: From one beginner to others . . .
by gryng (Hermit) on Jul 15, 2000 at 17:48 UTC
    is split optimized?

    The jist was that split is faster on smaller lines if you want the first feild, but a regex was faster for longer lines. We didn't go into a quest for further fields. However you could get the code we used and modify it for such.

    Enjoy,
    Gryn