Resource File Optimization via Source Code Analysis
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Modern software applications are large in size, consuming significant computing resources and network bandwidth, and existing techniques for reducing size, such as dead code stripping and file compression, are not always effective or applicable, leading to a need for further reduction in application size.
Innovation Solution
The technique involves analyzing source code and resource files to identify and remove duplicative or unused data, including values that are overwritten in initialization functions, thereby reducing the size of resource files and improving memory, processing, and power efficiency.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Quantity of substance
If dead code stripping is applied during compilation, then code size is reduced, but it does not affect code written in non-compiled languages and is limited by code-flow analysis
Solution Approach 1:
The patent segments the application analysis into two distinct phases: compile-time dead code stripping for compiled languages, and runtime dynamic analysis for interpreted languages. This segmentation allows each phase to use optimization techniques appropriate to its language type, thereby resolving the contradiction between reducing application size and maintaining applicability across different programming languages.
2Quantity of substance
If file compression is used to reduce application size, then download size is reduced, but decompression requires expensive processing on the client
Solution Approach 1:
The patent applies preliminary action by performing dead code stripping and optimization during the compilation and build process on the server side, before the application is distributed to clients. This eliminates the need for expensive decompression or processing operations on client devices, as the optimization work is completed in advance during application assembly.
3Productivity
If dead code stripping relies on code-flow analysis, then compilation-time optimization is achieved, but code referenced later is incorrectly identified as removable
Solution Approach 1:
The patent implements feedback mechanisms through runtime dynamic analysis that monitors actual code execution paths and resource usage. This feedback allows the system to accurately identify which code and resources are truly unused, preventing incorrect removal of code that may be referenced later under certain conditions. The runtime information feeds back into the optimization process to improve both accuracy and reliability.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
Technologies described herein reduce the size of a software application. In some embodiments, the size of one or more resource files of an application are reduced. Resource files include key/value pairs that define elements of the application. In some embodiments, the application's source code is analyzed to determine if an entry in a resource file may be removed. For instance, initialization functions in the application's source code may be analyzed to determine if a value loaded from a resource file is replaced before being used. For example, a button with a color property may be defined as grey by a resource, but later set to orange in an initialization function. In this case, the resource entry defining button as grey is superfluous and may be safely removed. This technique allows for entries to be removed from a resource file even though the source code references the entries.