Source Code Computing-Mode Analysis Without Runtime Sampling
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current code optimization technologies require running the source code to identify performance hotspots, leading to time overheads and increased analysis and optimization costs, especially for long-running applications.
Innovation Solution
A method to identify computing modes in source code without running it, using a computing mode template set for efficient identification, and logical analysis for segments that cannot be matched, followed by extracting mode information such as data flow and control flow features.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If sampling method is used to identify performance hotspots by running source code, then code optimization can be performed based on actual runtime behavior, but time overheads of sampling increase analysis and optimization time costs
Solution Approach 1:
The patent applies preliminary action by extracting and analyzing code semantic information before actual runtime execution. The system pre-processes source code to identify computing modes and performance hotspots through static analysis, eliminating the need for time-consuming runtime sampling while maintaining identification accuracy.
Solution Approach 2:
The patent replaces the mechanical runtime sampling process with a semantic analysis mechanism. Instead of relying on dynamic execution and sampling to identify performance hotspots, the system uses computational methods to analyze code semantics, control flow, and data flow relationships, substituting the mechanical sampling process with a more efficient semantic understanding approach.
2Productivity
If template matching is used to identify computing modes, then identification efficiency is improved, but identification accuracy decreases for complex code segments
Solution Approach 1:
The patent applies segmentation by dividing the code analysis process into multiple stages: first using template matching for rapid identification of common computing modes, then applying logical analysis only to code segments that fail to match templates. This segmented approach maintains high efficiency for the majority of cases while ensuring accuracy for complex segments.
Solution Approach 2:
The patent applies partial action by using template matching for the partial set of code segments that can be easily identified, and only applying the more complex logical analysis to the remaining segments that require it. This selective application of analysis methods optimizes the balance between efficiency and accuracy.
3Measurement precision
If logical analysis is applied to all code segments, then identification accuracy is improved, but processing time and complexity increase
Solution Approach 1:
The patent applies partial action by using template matching for the partial set of code segments that can be easily identified, and only applying the more complex logical analysis to the remaining segments that require it. This selective application of analysis methods optimizes the balance between efficiency and accuracy.
Solution Approach 2:
The patent applies preliminary action by using template matching as a preliminary step to filter out easily identifiable code segments before applying the more complex logical analysis. This preliminary filtering reduces the workload for subsequent analysis while maintaining comprehensive coverage.
Data Source
AI summary
In a code processing method, a computing device identifies a computing mode of each code segment in source code based on a computing mode template set that comprises a series of rules that correspond to each computing mode and that are written based on each computing mode. For a to-be-identified code segment that is in each code segment and whose computing mode is not identified based on the computing mode template set, the computing device identifies the computing mode of the to-be-identified code segment through logical analysis. The computing device then extracts mode information of each code segment, wherein the mode information comprises a data flow feature, a computing rule feature, a control flow feature, a storage format feature, or a communication operation feature.


