Precompiled Entity Identification for Selective Function Compilation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Precompiled header files that include templatized codes consume significant computational resources and time due to inefficient compilation of functions, negating the performance benefits of precompilation.
Innovation Solution
A processor or circuit identifies functions to compile based on the number of previous compilations and the time taken, using a profile file to selectively compile functions that exceed a threshold, thereby generating optimized precompiled header files.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If precompiled header files include templatized codes, then code reusability and adaptability are improved, but compilation time and computational resource consumption increase
Solution Approach 1:
The patent segments the header file content into two distinct parts: precompiled code sections and templatized code sections. The precompiled sections contain frequently used functions and macros that can be compiled once and reused, while the templatized sections are processed on-demand based on template instantiation requirements. This segmentation allows the system to achieve code reusability through precompiled sections while avoiding unnecessary compilation overhead for templatized code that may not be instantiated in every build.
Solution Approach 2:
The patent applies partial compilation by selectively compiling only the necessary portions of header files. Instead of compiling all templatized codes in advance, the system performs partial compilation of precompiled sections and leaves templatized sections to be compiled only when specific templates are actually instantiated. This partial action approach reduces overall compilation time while maintaining the adaptability benefits of templatized code.
2Adaptability or versatility
If precompiled header files include templatized codes, then code versatility is improved, but computational resource consumption increases
Solution Approach 1:
The patent divides header file processing into separate precompiled sections and templatized sections. The precompiled sections are processed once during precompilation and stored for reuse, while templatized sections are processed selectively based on actual template instantiation needs. This segmentation reduces computational resource consumption by avoiding redundant compilation of templatized code that may not be used, while preserving code versatility through the templatized sections.
Solution Approach 2:
The patent implements a self-service mechanism where the compilation system automatically identifies and processes only the necessary code sections based on actual usage patterns. The system monitors which templates are instantiated and compiles only those specific templatized sections, rather than precompiling all possible templates. This self-service approach optimizes computational resource usage by eliminating waste while maintaining full code versatility.
3Speed
If all functions in header files are precompiled, then compilation speed is improved, but resource usage efficiency deteriorates
Solution Approach 1:
The patent implements partial precompilation by selectively identifying and compiling only the functions and code sections that are most likely to be used across multiple translation units. Instead of precompiling all functions in header files, the system analyzes usage patterns and precompiles only the essential portions. This partial action maintains high compilation speed for the precompiled sections while improving resource usage efficiency by avoiding the waste of compiling unnecessary code.
Solution Approach 2:
The patent changes the parameter of precompilation from a binary all-or-nothing approach to a selective, criterion-based approach. The system uses parameters such as usage frequency, template instantiation patterns, and code section importance to determine which functions to precompile. This parameter change allows the system to optimize the balance between compilation speed and resource efficiency by precompiling only the most beneficial sections.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
Apparatuses, systems, and techniques to identify functions to be compiled in program code by compilers. In at least one embodiment, a processor includes one or more circuits to perform a compiler to identify one or more functions to compile based, at least in part, on a number of times the one or more functions were previously compiled.