Squeeze all the juices from Chromium on Linux

In this article, we will consider how to squeeze out all the juices from Chromium and accelerate it as much as possible or another browser on its engine (Chromium, Google Chrome, Opera, Vivaldi, Yandex, etc.). Due to the inclusion of many experimental capabilities for carrying out calculations from the processor to the video card and enabling the use of software algorithms under development. Due to this, our favorite chromium will work faster, it may stop braking or blink the screen .

Go!

How to make a backup copy of the entire browser profile (settings, history, bookmarks, etc.), is written at the end of the article.

We go to the address (yes, just type in the address bar or copy-paste)!chrome://gpu



As you can see, I always have the green inscription “Hardware accelerated”, which says that this function uses hardware acceleration by transferring the calculations to the video card, and “Enabled” says that the software algorithm is turned on.

Now go to chrome://flags.Here and will produce used on most of the settings. In the screenshot, the red rectangles are highlighted . Further, all the options from this list will be named exactly like this. You can press Ctrl + F and find the setting by its boiled name. Now we have open and , and . We look at what parameters are in , and if the parameter is not green, but yellow or red, we change the corresponding setting.



#ignore-gpu-blacklist



chrome://gpuchrome://flagschrome://gpuchrome://flagsCaution, some settings may make the browser unstable, depending on the hardware.

The Canvas - hardware accelerated rendering of the canvas
in chrome://flagsthis #ignore-gpu-blacklist
Off yuchaetsya you enable #disable-accelerated-2d-canvas

CheckerImaging - the bottom line is that the rasterization of the image is removed from the dependence of the rasterization of the rest area, which is connected with a picture, which allows to draw a web page, without waiting for the processing of images, such as So. They say Yulmart’s website is starting to render much faster.
This is a command line option --enable-features="CheckerImaging", more details below.

Flash, Flash Stage3D, Flash Stage3D, Flash Stage3D Baseline profile - hardware acceleration of decoding flash content
Also#ignore-gpu-blacklist

Compositing - hardware acceleration of layer overlay.
Most likely, too #ignore-gpu-blacklist, I have not seen that this does not work (it was not green) out of the box.

Multiple Raster Threads - parallelization onto several threads of the process of rasterization of vector elements of a web page
#enable-gpu-rasterization-> Force-enabled for all layers / Forced for all layers.
Enabling this option can also help if your screen blinks while browsing sites , including VKontakte, and video.

Native GpuMemoryBuffers - an extra buffer is excluded when copying elements between the CPU and GPU, it is turned off by default, why - is written in detail by reference.
This is a command line option --enable-native-gpu-memory-buffers, more details below.

Rasterization - application of a video card for rasterization
#enable-gpu-rasterization

Video Decode - hardware acceleration of video decoding (it is decoded when viewing a video)
Video Encode - similar coding
Included in #ignore-gpu-blacklist

WebGL, WebGL2 - support for rendering on a video card a set of OpenGL instructions included in the WebGL standard; automatically turns off if the video card driver does not support them.
Included in #ignore-gpu-blacklist

there is still an option #enable-zero-copy, the link aboveto an article by Intel engineers who developed this feature (judging by the screenshots and the introduction to the article, development takes place on Ubuntu, but is commercially profitable primarily because of Chrome OS). There is a suspicion that her work will be very specific to a particular iron.

#enable-tcp-fast-open- the TCP the Fast the Open , speeds up the network stack, a feature of the Linux kernel for Windows and MacOS is not available, vinduzyatnigi with **** unsuspectingly enjoy the handicap of its operating system, Yabloko they are not far behind (do not take to heart, it's a joke )

#expensive-background-timer-throttling- limits the maximum CPU load by background tabs (i.e. not the tab you are currently working with) to a maximum of 1%. Far from always appropriate. Suddenly, in the background tab, trading on the exchange is launched.

#v8-cache-options- for example, in the “Cache V8 compiler data” mode, the V8 will be better off caching javascript and not compiling them again. Yet again. On some complex web applications, in theory it can cause problems. V8 is a processing engine (including compilation) of javascript in Chromium, and javascript compilation creates the main load on the processor when the browser is running.

#v8-cache-strategies-for-cache-storage- you can enable the aggressive V8 cache, we are talking about the cache in the previous paragraph, the possible consequences are the same.

#shared-array-buffer- experimental memory functions in javascript, detailed explanation here .

#enable-simple-cache-backend-> Enabled - instead of implementing our likeness of a file system in a block file for the cache, we work with files directly inside the file system, placing most of the work on the operating system and reducing the load on disk I / O, including reduce the number of context switches, which should speed up the work.

Now about the command line options of Chromium and Google Chrome. Theoretically, browsers on the Chromium engine should support all sorts of other things , but there is no guarantee.
Close all open copies of Chromium, open the terminal and execute this command:
$ chromium-browser --enable-native-gpu-memory-buffers --enable-features = "CheckerImaging"

We chrome://gpusee how the CheckerImaging and Native GpuMemoryBuffers items turned green (or the browser did not start at all :)) But it’s not convenient to launch the browser every time, so we open the graphical editor for desktop files and add the parameters we need to the browser launch command (check note that at the end there is %U, it is replaced by a link or path to the file that needs to be opened, so it does not need to be deleted. In KDE, this kmenuedit(calling either through the terminal with a command kmenuedit, or moving the cursor to the application menu button and pressing the right button mouse 1 time Left-click 1 time on the “Menu Editor” in the list that appears), on the rest of DE (XFCE, GNOME, Budgie, LXDE, LXQt, etc.) this menulibre. Tru-Unixoids can copy



Menulibre, Chromium

Kmenuedit, Chromium

/usr/share/applications/chromium-browser.desktopin ~/.local/share/applications/chromium-browser.desktopand edit the Exec parameter, the same thing happens: Depending on the DE, you may need to re-place the shortcut to the desktop and / or panels. UPD 05/10/2018. Here is a complete list of flags for Chromium, which can be written directly in Exec in the Desktop file so that you do not need to manually enable them all:







chromium-browser --ignore-gpu-blacklist --enable-experimental-canvas-features --enable-accelerated-2d-canvas --canvas-msaa-sample-count = 2 --force-display-list-2d-canvas --force-gpu-rasterization --enable-fast-unload --enable-accelerated-vpx-decode = 3 --enable-tcp-fastopen --javascript-harmony --enable-checker-imaging --v8-cache- options = code --v8-cache-strategies-for-cache-storage = aggressive --enable-zero-copy --ui-enable-zero-copy --enable-native-gpu-memory-buffers --enable-webgl -image-chromium --enable-accelerated-video --enable-gpu-rasterization


How to measure the speed of the browser , to understand which options on your combination of hardware and a video driver speed up and which ones slow down?
To do this, run the web.basemark.com online benchmark with various combinations of settings and compare the number of points scored by parrots .

The chrome://gpumother can swear to the mother that hardware acceleration of video decoding is enabled. But not every video will be decoded in hardware!
We open chrome://media-internals/, in parallel, start playing some video from Youtube and see which codec it decodes.



Now Google gives all the video in the VP9 codec of its own design, but on quite a lot of old video cards only H.264 hardware decoding is possible; The h264ify extension will cause the browser to report that it does not support VP8 and VP9 codecs, which will cause Youtube to upload video to H.264. See youtube.com/html5

By default, this way: With h264ify enabled on its standard settings: There is generally no single normal list of which drivers and which graphics cards support hardware decoding, but Chromium 62 will have a full-fledged VA-API (API for hardware acceleration) video encoding and decoding), which was before, but only on ChromeOS, but, for example, here







Chromium was collected and is being assembled with a patch that includes this on Linux as well. For work, the latest version of libva is recommended; if you have, for example, Ubuntu 16.04, then you can update the entire graphics stack from here , which is recommended for users of modern and not very Intel and AMD graphics cards, because Nowadays, the open-source graphic stack is developing very quickly, and in the article we used many functions for working with a video card. Ubuntu 17.10 developers have worked to improve the VA-API out of the box. In general, I've never encountered problems playing videos on Linux, everything works out of the box. There was an add-on for Firefox, which allowed the YouTube video to play in an external mpv player, which on very old machines could significantly reduce the load on the processor.

- Help! The browser has stopped starting !!!
- This happens very rarely, but it sometimes happens when the settings for working with a video card are twisted so that the browser cannot work with it. Open the folder in the file manager ~/.config(~ is your home folder) and find the chromium folder (for Google Chrome it is called google-chrome, Vivaldi - Vivaldi, etc.). It stores our profile. You can simply rename the folder, for example, in chromium.old, and the next time you start chromium, it will create it again and start from scratch. As a backup (backup)



I recommend that you archive this folder (and store it like the apple of an eye) before carrying out all the manipulations. If you broke something, but don’t want to start with a clean profile, then try opening the terminal inside ~/.config/chromiumand running the command:
$ grep -inHr "ignore-gpu-blacklist"

where instead of ignore-gpu-blacklist, substitute the name of the option, which, as you think, is the cause of the problem. In response, the grep command will display the path to the file and the line number where there is a chance to correct the setting. Perhaps some of the settings are stored in the SQLite database, and then some program will be needed to work with the SQLite database and search for them. Honestly, I have never tried to do this. I'm leaving for sim, thanks for your attention, I'm waiting for feedback and questions in the comments.




Also popular now: