featdd / dpn_glossary

Glossary extension for TYPO3

Home Page:http://typo3.org/extensions/repository/view/dpn_glossary

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Limit parsing to configurable node/container (ID)

julianhofmann opened this issue · comments

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).

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

Hi @julianhofmann,

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

Greetings
Daniel