featdd / dpn_glossary

Glossary extension for TYPO3
http://typo3.org/extensions/repository/view/dpn_glossary
GNU General Public License v2.0
20 stars 30 forks source link

Limit parsing to configurable node/container (ID) #185

Closed julianhofmann closed 1 year ago

julianhofmann commented 1 year ago

Currently, the extension is parsing always the whole DOM. All the forbidden*-properties only apply when the nodes are traversed and then excluded via XPath. On a page with a huge amount of tags/nodes (e.g. with a huge mega-menu or long side navigation) a number of loops are run through in order to ultimately not process the excluded tags.

IMO a way cleaner and more performant way would be, to only parse the relevant part of a page. Mostly, you have already some kind of wrapper around your content and only this content is relevant to the glossary. So, we could take only this node for parsing.

A proof-of-concept for that feature has lowered the rendering time of a page (1500 terms, 2800 synonyms) from 9,5s to only 3.7s (All caches have been flushed before).

featdd commented 1 year ago

Hi @julianhofmann,

thanks for your suggestion, I'll keep that in mind for the upcoming compatibility update when the v12 LTS arrives.

I remember this not beeing trivial to do with DOM Document, but it's been some years though and maybe is some technical debt caused by a lack of experience years ago. But normally the hook should run on non cached requests only, so if your page is cached the parser won't run anyway.

Greetings Daniel

featdd commented 1 year ago

Hi @julianhofmann,

this is now merged: 876c74abf72b77d23e65c3a5d7dc006878c0182c Thanks for your work.

Greetings Daniel