Python is not my best language, and so I\'m not all that good at finding the most efficient solutions to some of my problems. I have a very large string (coming from a 30 MB
Is it really slow? You're talking about 30MB string; let's try it with even bigger string:
In [12]: string="agu82934u"*50*1024*1024+"string to be found"
In [13]: len(string)
Out[13]: 471859218
In [14]: %timeit "string to be found" in string
1 loops, best of 3: 335 ms per loop
In [15]: %timeit "string not to be found" in string
1 loops, best of 3: 200 ms per loop
I wouldn't say that 335 ms is much time looking for substring in 450MB string.