|
Just thought I'd point out that using something like LPEG will probably end up bumping your memory usage up more than a bit of redundant string data. You might want to benchmark something like:string.sub(data, string.find(data, "<.=/>"), startpos):gsub(pattern_to_visit_fields, function(...) ... end )Obviously this own't compile, and you probably need to break it up some to update your bookkeeping, but you get the idea. Might be worth testing against other things in terms of memory and speed.--On Sat, May 30, 2015 at 1:54 AM, Enrico Colombini <erix@erix.it> wrote:On 29-May-15 21:30, Lionel Duboeuf wrote:
But as i said, i need to specify a starting position (which doesn't
exist in gmatch and gsub functions) and can't afford to split my string.
As an aside, I encountered the same problem when I thought about adding features to my 50-line in-memory XML parser (for a small enough definition of 'XML', but it could read OpenOffice files).
I always forgot to ask if adding an optional starting point for gmatch/gsub would be too costly.
--
Enrico
Brigham Toskin