Performance Optimization Tool syzyprof in Chromium

Source: Internet
Author: User
Function performance analysis tool syzyprof

First, I will introduce syzyprof. This tool can capture the execution time of each function call by each thread, generate a data format file that can be recognized by kcachegrind, and then display the result through kcachegrind. You can know which function has the most execution times, the most time consumed, which thread is reading and writing files, and which thread is on the window creation interface, in addition, kcachegrind graphically displays information such as the function call chain, which is very intuitive. This is the function call information of the demo program that I generated in CEF.

In fact, there are already enough functional performance analysis tools, such as xperf, aqtime, and the performance analysis functions provided by Visual Studio. However, these tools are heavyweight, and some need to debug the mode to run the target program, which has a great impact on the efficiency of the target program.

Compared with syzyprof, syzyprof is a lightweight function performance analysis tool with simple configuration and has little impact on the single-run efficiency of the target program. In fact, the working principle of syzyprof is very simple. It is to add the/profile switch to the compiler, and then compile the PE file with some extra space, syzyprof inserts commands in these extra spaces, modifies the compiled PE file, hooks the call of each function, and records the execution information of the function. /Profile is the operation space reserved by vs compiler for performance optimization. This interface is also used for vs performance optimization.

Incredible stockade (syzygy)

If Chromium's performance optimization is limited to syzyprof, It's too common. It also has a killer-syzygy. Syzygy uses the function performance analysis data generated by syzyprof to re-optimize the distribution of functions in the PE binary file. For example, early functions called are placed before the PE file, functions that are frequently called and closely called are put together to reduce page-missing interruption errors during program running, thus reducing program Cold Start Time and memory usage. Because the word syzygy is too pronounced, I usually call it a stockade.

It sounds incredible, but it does. That's why the Chrome browser started so fast. Chromium claims that syzygy can reduce the cold start time by 80% and memory usage by 40%.

In fact, the distribution of PE file functions generated by the Visual Studio compiler is almost random relative to the execution sequence, this causes some unnecessary page breaks during execution of the program, resulting in an increase in cold start time. There are also poor access to code and data in different pages, resulting in larger memory working sets. These are exactly what syzygy is optimized.

Microsoft has long used the same technology for some modules in Windows to re-distribute PE files, such as ntoskrnl.exe, which is not generated by the compiler by default. Microsoft started this research very early, binary technologies projects binary transformation infrastructure. This kind of performance optimization is not the first idea of chromium, but it is indeed chromium.

Syzygy needs to change the PE file for optimization, which will cause the PE file to not match the original PDB file and cannot be debugged using the PDB file, for this reason, when syzygy changes the PE file, it also modifies the corresponding PDB file.

Summarize the technologies used by syzygy:

  • Use the/profile interface provided by the compiler to insert the instruction to hook the function in the generated PE file.
  • Use the event tracing for Windows mechanism to obtain function performance data of the target program.
  • A Rescheduling policy is generated based on the function performance data. The Compiler interface is called to rearrange the PE file and the DIA (debug interface access) interface is called to modify the PDB file.

It does not seem complicated, but the PE file is broken down behind the scenes, and some symbols generated by the compiler cannot be re-arranged. There are a lot of dirty words under it, which need to be tried and put down by mistake to understand.

Performance Optimization Tool syzyprof in Chromium

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.