On a worst case pattern match with backtracking:
string.match(("a"):rep(1e7) .. "b", ".-b")'
Lua performs 54 times better than the equivalent program using this
package. This is almost certainly to do with the fact that I
implemented a stringPointer type that allowed for a line-by-line port.
It's important to note that this is not an idiomatic port, and
therefore is not designed to be fast, although I would like to get
there eventually.
I doubt this will be of major use to anyone, but please let me know if
you decide to use it and have any feedback or suggestions.
What does this string pointer type do that a byte slice doesn't?
From a brief look it seems to do exactly the same thing.
- jessta
--
=====================
http://jessta.id.au
Of course they accomplish the same task, but a line-by-line port of
code that is overly using pointer arithmetic is more difficult when
you need to convert everything to using slices. That and once you've
moved forward in a slice you can't go back, i.e. there's no way to
p--.
This was merely a first attempt to better understand the Lua pattern
matching code, as i said, a more idiomatic solution will likely follow
if I find myself using this quite a lot.
- Jim