Open Bug 766333 Opened 13 years ago Updated 3 years ago

Adblock Plus causes significant pageload slowdown on a page with tens of thousands of images

Categories

(Core :: General, defect)

x86
macOS
defect

Tracking

()

People

(Reporter: BenWa, Unassigned)

References

Details

(Whiteboard: [Snappy:p2][sps])

Whiteboard: [Snappy][sps]
14:36 < BenWa> taras: Ok so I spoke to joe & ehsan. The profiles seems to indicate the AdBlock is invoking Document.write which is very inneficient and the dreaded 'synchronous' type of calls 14:37 < BenWa> It apparently stops parsing, processes the document the write, throwing away the parsing up to date and restarts 14:37 < ehsan> to make it more inefficient, you can call document.open before .write ;) 14:37 < BenWa> ok 14:37 < ehsan> and then you can do it in a loop 14:37 < ehsan> and bingo!
Is this Adblock, or Adblock Plus?
Adblock Plus 2.0.3
(In reply to Taras Glek (:taras) from comment #1) > 14:36 < BenWa> taras: Ok so I spoke to joe & ehsan. The profiles seems to > indicate the AdBlock is invoking Document.write Adblock Plus doesn't use document.write(), the web page is doing it itself. JavaScript Deobfuscator indicates that http://forums.mtbr.com/clientscript/vbulletin_thrdpostlist.js?v=387 is the culprit, function writeLink() is invoked 2705 times and performs a bunch of document.write() calls each time (average execution time displayed as 18 ms on my machine). The page source contains a huge script block with writeLink() calls starting at line 1980, there are indeed that many calls there. And that it completely independent of Adblock Plus, not sure why you see a difference with Adblock Plus off. Note that the Facebook widgets also cause a significant slowdown on this page, these insert a node into the document 10 times per second. They aren't the biggest issue however, the page is still terribly slow even after I blocked them.
Wlad, do you have an idea of why ABP is causing (~10x on my machine) slowdown in pageloading?
After looking at this with Diagnostics for Adblock Plus - yes, I do. The "hybrid mode" produces 22000 content policy calls, as opposed to 400 content policy calls in the regular case. That's a whole lot of requests for these addresses: http://forums.mtbr.com/images/misc/paperclip.gif http://forums.mtbr.com/images/misc/tree_t.gif http://forums.mtbr.com/images/statusicon/post_old.gif http://forums.mtbr.com/images/misc/tree_i.gif http://forums.mtbr.com/29er-bikes/clear.gif If you check, these images are really there - in the tree view produced via document.write(). That's a lot of content policy calls to process, despite the caching. According to Diagnostics, Adblock Plus needs on average 0.4ms for each call on my machine, plus XPCOM overhead. I want to look into making our shouldLoad implementation faster but I don't think that it can be magnitudes faster than it currently is.
Summary: Adblock uses document.write() which hangs during loading on some pages → Adblock Plus causes significant pageload slowdown on a page with tens of thousands of images
If we did the loads async (which we want to anyway), we could at least do them form a separate event queue and throttle them or something....
(In reply to Boris Zbarsky (:bz) from comment #7) > If we did the loads async (which we want to anyway), we could at least do > them form a separate event queue and throttle them or something.... Is there a bug/API-proposal for this?
Whiteboard: [Snappy][sps] → [Snappy:p2][sps]
I don't know offhand.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.