Skip to content

Loading…

Reload all tabs when all filters are initially loaded #108

Closed
kikaxa opened this Issue · 25 comments

2 participants

@kikaxa

When you start browser with "restore last tabs", some pages manage to load a ton of ads in the time it takes to load all filters.

"adblock"(In old opera) implemented this(and was freezing whole browser for several seconds on startup), while "adblock plus" skips(everywhere) and lets ads through.

Please consider adding the option for this.

Edit:after some discussion, it seems to be impossible to delay tab loading, hence the change in the title

@ghost

If this feature gets added, it should be optional, i.e checkbox in settings. Not all users want this.

@kikaxa

Definetly, i meant this with "adding the option"
And it might happen to be fast enough to enable by default, and remove that checkbox

@ghost

No without checkbox.

@gorhill

Everything is asynchronous in chromium, you can't block a page from loading.

@kikaxa

what about network requests?

@gorhill

what about network requests?

What about them?

@kikaxa

If I understand correctly, ublock checks for filters in chrome.webRequest.onBeforeRequest.
Could you wait here for some (filters loaded) event?

@gorhill

My understanding is that their is a timeout, after which the browser will yank control from the extension. If the handler takes more than 10ms (last time I check), it will be marked as a slow extension, and the user will be warned about this. Also, there is absolutely no documentation that extensions are loaded first before web pages, so that would be a lucky hack if it ever that would work. The browser is the maestro, and aside the exactly three event handler which are documented to be optionally synchronous (onBeforeRequest, onBeforeSendHeaders, onAuthRequired), no assumption should be made.

@ghost

You can only block websites from loading with Firewall and proper IP-addresses. As far as I can tell.

@kikaxa

I found this:
https://code.google.com/p/chromium/issues/detail?id=99450

Sadly, they had the fix and still reverted it exactly for this reason - adblock took too long to load, before pages started loading :(

BTW, have you measured load time for ublock?

@kikaxa

As a replacement, in comment they suggest using
https://developer.chrome.com/extensions/declarativeWebRequest
but it's not available on stable.

@gorhill

BTW, have you measured load time for ublock?

It completely depends on the number of lists to load, which is user's choice in the end. But I've tried to avoid big memory churn by not using the usual String.split() on a big file, I seek for end-of-lines instead, and extract a string out of rolling indices.

@ghost

Lightweight as possible is the way to go.

@gorhill

I don't see how delarativeWebRequest is of any help to hold back loading web pages. It's purpose is as a replacement of webRequest.

@kikaxa

Yep, of no help. Mentioned in case you might be interested in its' "performance"

Then, the only thing i might imagine is reloading all open tabs when loaded.

I measured time for µBlock.load(); call, and got 4ms. Is it the right thing to measure?
Edit: of course, not. Now, for µBlock.loadUpdatableAssets, 2s. I hit it?
+3s for processList(), 84k filters.

@kikaxa kikaxa changed the title from Delay page loading/network requests until all filters are loaded to Reload all tabs when all filters are initially loaded
@gorhill

I measured time for µBlock.load()

Whatever it calls is asynchronous, so this timing means nothing. The thing to do is profiling the extension background page, and force-refresh taht page after you are sure all the filters ar eloaded. Then the profiler will show you what consumed the most time.

@kikaxa

Measured it that way, got 850ms total for Apply func.

@gorhill

How many refreshes? The time is cumulative, you need to divide by how many time you refreshed, and be sure that the filters loaded fully before refreshing.

@gorhill

That's the proper way to profile: this shows you where time is spent most. Apply is clearly irrelevant (that was maybe for 7 refreshes, I didn't count, I just wanted the top funcs were time is spent):

to-forum

@kikaxa

I re/check some lists, then click apply, while profiling. if i do refresh-only, i get instant update, nothing in profile. btw, i'm still on 2.3.5 for opera.
untitled

Edit: Well, it seems we are thinking about different things :). I was trying to get total list loading time.

@gorhill

if i do refresh-only, i get instant update, nothing in profile

Yeah, I meant profile the background page, not the dashboard... Dashboard is just UI, the real code is in the background page. Look, I can't spend too much time on such an issue, I doubt I will agree to reload all tabs after the extension loads, that's too intrusive. If the extension has problem to reach some remote servers, it could take a while before the lists are seen as all loaded, and you could end up annoying royally the user if you then reload. It's a small annoyance in the big picture. I rather invest my limited time where I feel we get the biggest bang for the buck. It's a hobby time project.

@kikaxa

Aha, I got it. Still, gives the same time for me. Thanks anyway.

Yeah, you're right.
Still, I would be happy not to have to manually reload tab to get rid of ads.

If it's okay, I would like to implement fix for this, if we find the way to satisfy everyone.
We could check if the tab already has some blocking applied, and refresh only those that have not.
We could make a checkbox, we could make anything! :)

Btw, are you always wait at startup for updated version?
It would make more sense to load local copy, then update when new data arrive.

@gorhill

Btw, are you always wait at startup for updated version?

You mean the lists? There is a small checksum file loaded from the repo, and this tells uBlock what needs to be pulled from remote servers. So unless there are updated assets, all lists are fetched from the cache, or the extension directory if not in cache. External lists (custom) are cached and purged from the cache every two days. So in all likelihood, all is pulled locally.

@kikaxa

So, in worst case, you wait for checksum, then wait for update? What'll happen if update server is down?
It would be better to always load local copy(possibly in optimized format), and check for updates asyncronously.

@kikaxa

After some thinking I dislike reloading idea even more than the ads.
There seems to be no other way to fix this issue, so I'll close it.

@kikaxa kikaxa closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.