Profile-guided optimization

For example, inferring or placing formal constraints on the number of iterations a loop is likely to execute is fundamentally useful when considering whether to unroll it or not, but such facts typically rely on complex runtime factors that are difficult to conclusively establish.[5][6][7] The compiler accesses profile data from a sample run of the program across a representative input set.The caveat, however, is that the sample of data fed to the program during the profiling stage must be statistically representative of the typical usage scenarios; otherwise, profile-guided feedback has the potential to harm the overall performance of the final build instead of improving it.The HotSpot Java virtual machine (JVM) uses profile-guided optimization to dynamically generate native code.[11] Google published a paper [12] describing a tool in use for using production profiles to guide builds resulting in up to a 10% performance improvement.
computer programmingcompiler optimizationprofilingruntime performancestatic program analysissource codedynamic program analysisunrollMonte Carlorandom number generatorinstrumented programgenerated codeheuristicsJust-in-time compilationruntimeFirefoxhardware performance countersHotSpotJava virtual machineadaptive optimizationdynamically recompileMicrosoft WindowsGoogle Chrome64-bit32-bitIntel C++ CompilerFortranGNU Compiler CollectionOracle Solaris StudioMicrosoft Visual C++IBM XL C/C++GraalVMDynamic dead code eliminationGlobal optimizationHot spot (computer programming)Interprocedural optimizationLink-time optimizationTracing just-in-time compilationBibcodeCompiler optimizationsPeephole optimizationLocal value numberingLoop nest optimizationLoop splittingLoop unrollingLoop unswitchingSoftware pipeliningStrength reductionData-flowanalysisAvailable expressionCommon subexpression eliminationConstant foldingDead storeInduction variable recognition and eliminationLive-variable analysisUpwards exposed usesUse-define chainReaching definitionsGlobal value numberingSparse conditional constant propagationCode generationInstruction schedulingInstruction selectionRegister allocationRematerializationDeforestationTail-call eliminationBounds-checking eliminationCompile-time function executionDead-code eliminationExpression templatesInline expansionJump threadingPartial evaluationAlias analysisArray-access analysisControl-flow analysisData-flow analysisDependence analysisEscape analysisPointer analysisShape analysisValue range analysis