M
Martin Pirker
Hi...
given: String of several Mb
problem: find the lines in String containing "xyz"
Idea 1:
String.scan(/.*xyz.*/) -> ~10s runtime
Idea 2:
String.grep(/.*xyz.*/) -> ~3s (but gives the \n too)
Idea 3:
loop String.index("xyz",lastmatch+3)
loop results array and grep in match area for line
-> 0,5s
C extension the only faster option left?
Martin
given: String of several Mb
problem: find the lines in String containing "xyz"
Idea 1:
String.scan(/.*xyz.*/) -> ~10s runtime
Idea 2:
String.grep(/.*xyz.*/) -> ~3s (but gives the \n too)
Idea 3:
loop String.index("xyz",lastmatch+3)
loop results array and grep in match area for line
-> 0,5s
C extension the only faster option left?
Martin