Hmm, tried to extract the logic from current parser, but I don’t get a clue on how the snippets are parsed currently, to be more precise, how the properties for a snippet are parsed and applied.
Due that, I’m not able to compare both, sorry.
(preg_match_all() seems to be a very fast function, so don’t expect the recursive parser to be faster though)
But don’t be affraid, the current parser allready _is_ fast!
I suppose it makes sense to have this in mind:
- What do we want the parser to be able to do.
- How is caching supposed to work.
- How can we make the caching smart and robust
In my profiles from the current parser, nothing showed up as bottlenecks in regard to the parsing logic (preg_match_all(), or strpos for example)
In my opinion, the truth behind a fast parser is not that it’s so fast that it can handle xxx requests per second, but that it only parses the parts that needs to be parsed.
So, in other words, use the cache if possible.
Right now, the [!Yada!] makes it possible to insert some dynamic piece of html code into a cached html page.
Some numbers from my poor server:
True cached page: 16 requests/sec
Cached with [!!] : 12 requests/sec
Non cached : 10 requests/sec
As you seed, the evaluating of the snippets, and the corresponding executed php code,as well as the database calls degrade performance more then the parser does in respect to the little parsing time and replacement of [[ ]] tags.
However, the difference of a
true cached non-cached an semi-cached page are not so huge!
So, what about adding "smart" logic to determine if a snippet has to be executed or not, and depending on the result, use true cached, semi cached or non cached template parsing?
For example, how many pages will actually change, even on a very dynamic site?
Once per minute?
Then the question is, how many page requests does this site get? Lets say, 60 per minute.
Then I wouldn’t be surprised to have the pages cached, and recreated after a page has been added/updated in the database, and still having a better speed increase, then using [!!] logic....
(I hope you still followed me

)
(In other words, simply clean the cache after a page modification, and start caching the generated pages from that point again. But perhaps I’m overlooking something important now...)
Remon