Closed mneunomne closed 1 year ago
In the PR above I implemented the following line in the process function:
if(elem.hasAttribute('process-adn')) {
logP('Element already processed by parser')
return;
} else {
elem.setAttribute('process-adn', true)
logP('Process(' + elem.tagName + ')',
elem.tagName === 'IFRAME' && elem.hasAttribute('src')
? elem.getAttribute('src') : elem);
}
I tested and it seems to not affect the amount of collected ads. On one run on pinterest.com I got 378 counts of [PARSER] Element already processed by parser
logs, meaning, 378 times in one load that queries, img checks etc etc were not processed again without necessity.
that's great -- my only concern is that these elements are constantly changing, so we need a mechanism (a hash?) with which we can tell whether the element has changed, and if so, process it again
Yes, I was wondering thre same thing. But maybe it will have high cost to create listeners to all these dom elements? Need to test it.
element.addEventListener('DOMNodeInserted', callback);
Best solution is to remove any adn-process
attribute on the domWatcherInterface itself, here:
Implemented https://github.com/dhowe/AdNauseam/issues/2236
It seems that our parser keeps parsing the same elements over and over every time the filtering mechanism is activated.
I would suggest for us to mark the elements that we have already processed with a
process-adn
tag or something of that nature. It would in theory save some processing power on the client side.