Can you explain me how Profile-guided optimization works and why it works?
user
Profile-Guided Optimization (PGO) improves application performance by reorganizing code layout to reduce instruction-cache problems, shrinking code size, and reducing branch predictions. Profile-Guided Optimization PGO provides information to the compiler about areas of an application that are most frequently executed.     
Build the library/executable with instrumentation 
profile-generate to the compiler and linker.
    Collect profiles by running a representative workload on the instrumented binary.
assistant