Opened 21 months ago

Last modified 21 months ago

#6372 new change

FilterEngine method invocations take too long — at Version 3

Reported by: asmirnov Assignee:
Priority: P3 Milestone:
Module: Libadblockplus Keywords:
Cc: sergz, jwangenheim, diegocarloslima, fhd Blocked By:
Blocking: Platform: Android
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description (last modified by asmirnov)

Background

We're obviously using some filterEngine methods for ad blocking: GetHostFromURL(), IsDocumentWhitelisted, etc. in Chromium+ABP integration.

I've added invocations time logging to know how long it takes and sometimes it takes few seconds!

02-09 12:32:59.614 24543-24859 W/chromium: [WARNING:chrome_network_delegate.cc(397)] Adblock: invoking IsDocumentWhitelisted(https://www.google-analytics.com/collect?v=1&_v=j66&a=1716373988&t=pageview&_s=1&dl=https%3A%2F%2Fm.lenta.ru%2F&ul=ru&de=UTF-8&dt=Lenta.ru&sd=32-bit&sr=360x640&vp=360x559&je=0&_u=ACCAgEAB~&jid=1446535111&gjid=2137434587&cid=1332390533.1518156547&tid=UA-18447330-66&_gid=956643543.1518156547&z=2118792885)
02-09 12:33:03.904 24543-24859 W/chromium: [WARNING:chrome_network_delegate.cc(401)] Adblock: document NOT whitelisted https://www.google-analytics.com/collect?v=1&_v=j66&a=1716373988&t=pageview&_s=1&dl=https%3A%2F%2Fm.lenta.ru%2F&ul=ru&de=UTF-8&dt=Lenta.ru&sd=32-bit&sr=360x640&vp=360x559&je=0&_u=ACCAgEAB~&jid=1446535111&gjid=2137434587&cid=1332390533.1518156547&tid=UA-18447330-66&_gid=956643543.1518156547&z=2118792885
02-09 11:59:02.074 30449-30677 W/chromium: [WARNING:chrome_network_delegate.cc(383)] Adblock: extracting host from url https://collector.mediator.media/register/?cid=2819706&url=https%3A%2F%2Fm.e1.ru%2F&ref=&p=2&e=t0
02-09 11:59:06.534 30449-30677 W/chromium: [WARNING:chrome_network_delegate.cc(385)] Adblock: extracted host "collector.mediator.media" from url https://collector.mediator.media/register/?cid=2819706&url=https%3A%2F%2Fm.e1.ru%2F&ref=&p=2&e=t0

It means resource loading is blocked and the thread is just blocked. It seems to be fundamental limitation for our current design (JS code < C++ wrapper < Java wrapper) as we bring JS single-threaded nature into multi-threaded by nature applications.

BTW while loading of website a user can go to Settings. In order to show them we do invoke some FilterEngine methods, that due to JS nature are executed in same single thread. So either settings UI (main thread) or resource loading is blocked just because behind the scene it's invoked in the same thread.

What to change

Probably this can be solved by using Emscripten and avoid using JS code.

Change History (6)

Changed 21 months ago by asmirnov

Changed 21 months ago by asmirnov

Changed 21 months ago by asmirnov

comment:1 Changed 21 months ago by asmirnov

  • Cc sergz jwangenheim diegocarloslima fhd added
  • Description modified (diff)

comment:2 Changed 21 months ago by asmirnov

  • Description modified (diff)

comment:3 Changed 21 months ago by asmirnov

  • Description modified (diff)
Note: See TracTickets for help on using tickets.