Skip to content

Delayed entering of Fullscreen Mode as compared to Chrome #20384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
garygreen opened this issue Jan 7, 2022 · 11 comments
Open

Delayed entering of Fullscreen Mode as compared to Chrome #20384

garygreen opened this issue Jan 7, 2022 · 11 comments
Labels
needs-investigation A bug not 100% confirmed/fixed OS/Desktop OS/Windows perf priority/P4 Planned work. We expect to get to it "soon".

Comments

@garygreen
Copy link

garygreen commented Jan 7, 2022

Description

When going fullscreen on a Youtube video there is a noticeable 500ms (ish) delay as compared to Chrome

1sec on Chrome
1.5sec on Brave

This seems insignificant, but it's something that I personally noticed when trying out Brave as a long term Chrome user. There doesn't seem to be any reason why going fullscreen would be 33% ish slower on Brave on my machine as compared to Chrome? So I can only assume this is some kind of optimization issue, possibly lots of reflows/layouts going on causing the slowdown compare to Chrome.

Steps to Reproduce

  1. Navigate to a Youtube video e.g. https://www.youtube.com/watch?v=LXb3EKWsInQ
  2. Go fullscreen by pressing 'F'
  3. Observe the delay in being fully fullscreen as compared to Chrome

Video Demonstration

chrome-brave-fullscreen-delay.mp4

Expected result:

Fullscreen mode should open and close in same amount of time and snappiness as Chrome.

Reproduces how often:

Every time

Brave version (brave://version info)

1.34.80 Chromium: 97.0.4692.71 (Official Build) (64-bit)
adefa7837d02a07a604c1e6eff0b3a09422ab88d-refs/branch-heads/4692@{#1247}
Windows 10 Version 21H1 (Build 19043.1415)

Other Additional Information:

  • Does the issue resolve itself when disabling Brave Shields?
    Disabling Brave shields does improve it slightly, but still a delay

  • Does the issue resolve itself when disabling Brave Rewards?
    No

@rebron
Copy link
Collaborator

rebron commented Jan 10, 2022

cc: @iefremov @mkarolin There is a noticeable delay in going to full screen.

@garygreen Sounds like you're seeing this consistently with multiple videos on YouTube?

@rebron rebron added the needs-investigation A bug not 100% confirmed/fixed label Jan 10, 2022
@garygreen
Copy link
Author

@rebron That's correct, it happens on every video. The delay can also be seen on other sites like https://vimeo.com/156942975 - however the difference isn't quite so profound as Youtube.

@iefremov
Copy link
Contributor

@garygreen can you please share brave://gpu from Brave and chrome://gpu from chrome?

@rebron rebron added the priority/P4 Planned work. We expect to get to it "soon". label Jan 11, 2022
@iefremov
Copy link
Contributor

@atuchin-m any ideas maybe?

@garygreen
Copy link
Author

Turning Brave shields off definitely makes a noticeable improvement - it's down from roughly 1.5sec fullscreen to around 1sec fullscreen. Chrome is actually a big quicker than 1 sec opening.

What happens during layout updates? I wonder if Brave Shields observe updates to the DOM and crawls through it causing layouts, reflows and other stuff when it mutates which could cause this slowdown when going into fullscreen?

@garygreen
Copy link
Author

garygreen commented Jan 12, 2022

Could it possibly be due to the filtering of cosmetics? Maybe I'm digging in the wrong place, but looking at code it seems to observe for every mutation of the DOM, attributes, subtree and childnode modifications - then seems to call back to Rust for adblocking analysis? I assume that's an asynchronous operation? https://github.com/brave/brave-core/blob/f08ca55a6b3333c4e8e6af57b203ddc44f631a6f/components/cosmetic_filters/resources/data/content_cosmetic.ts

When going fullscreen quite a lot of mutation observers are triggered. Again, I maybe barking up the wrong tree here, but just trying to wonder why turning Brave Shields off would have a positive improvement.

image

@iefremov
Copy link
Contributor

@antonok-edm @ryanbr maybe you could take a look when you have some time

@antonok-edm
Copy link
Collaborator

@garygreen Yes, the MutationObservers are used for cosmetic filtering; they are important to catch new elements on the page that should be hidden by the adblock engine.

From what I can tell, there are a significant number of modifications to the page layout when youtube enters fullscreen mode; so this is probably expected. If you look at Chrome + uBlock Origin I imagine the delay is approximately equal. uBO uses a similar approach to cosmetic filtering.

You're always welcome to disable Shields if you find the delay unacceptable, of course with the tradeoff of seeing ads again.

@garygreen
Copy link
Author

garygreen commented Jan 24, 2022

@antonok-edm

If you look at Chrome + uBlock Origin I imagine the delay is approximately equal. uBO uses a similar approach to cosmetic filtering.

I use uBlock with Chrome and have zero delay issues with it... In brave it's quite hard to test if the cosmetic filtering is actually causing this delay or not, as there doesn't appear to be a way to simply disable cosmetic filtering in Brave?

@antonok-edm
Copy link
Collaborator

antonok-edm commented Jan 24, 2022

@garygreen That's good to know.

For testing you can disable cosmetic filtering globally via the #brave-adblock-cosmetic-filtering flag in brave://flags.

@urbenlegend
Copy link

urbenlegend commented Jul 25, 2022

Experiencing this same issue as well. Tested with Firefox + uBlock Origin and it is much smoother compared to Brave + Shields.

I will say that it isn't consistent to reproduce. Sometimes YT fullscreens fast and sometimes it is definitely slower than Chrome. It also seems to get worse when watching a long video for a long time, like this one: https://www.youtube.com/watch?v=8zxeGydXY98

@rebron rebron added this to General May 28, 2024
@rebron rebron moved this to P4 Backlog in General May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-investigation A bug not 100% confirmed/fixed OS/Desktop OS/Windows perf priority/P4 Planned work. We expect to get to it "soon".
Projects
Status: P4 Backlog
Development

No branches or pull requests

5 participants