A state machine that does it all in one pass has been my holy grail for like 4 years now. Btw.. when I say I've been working on it for 4 years that's not like 4 years of sustained effort or anything, it's a good coding session every now and then interspersed with a lot of other things!
Surely this $aXML =~ s@;([^:;]+?):@\[$1\(@gs; is the only backtracker there, and also it comes prior to the "save this to disc then process" marker so it only gets run once when the page is still in it's raw aXML state, not every time the page is requested.
That leaves this while ($aXML =~ m@\[([^\[\]]*?)\]@gs) { ... }
Which makes as many passes as it needs to decode the structure, in what I visualise as a sort of 3d way with the innermost tags being the highest peaks getting mown down one tag height at a time, until the document is flat.
Hrm, maybe I could save the $level data into an array to determine character positions for processing... that would help!
In reply to Re^2: Fast enough yet?
by Logicus
in thread Fast enough yet?
by Logicus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |