Inlining Constants to Reduce Executable Bundle Size
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Traditional systems are inefficient in reducing the size of bundles of executable files due to the inability to effectively remove constant files, which slow down computer performance during user onboarding and other processes.
Innovation Solution
The method involves transforming constant files into inlined values, allowing large portions of computer modules to be avoided, and replacing references to pure files with their exported values, thereby unlinking and removing unnecessary files from the bundle.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Loss of substance
If Tree Shaking technique is used to remove dead-code, then code size is reduced, but it cannot remove constant files exported as large objects
Solution Approach 1:
The patent segments the constant object into individual constant values and inlines them directly into the importing module. Instead of exporting a large constant object that must be loaded as a whole, each constant value is extracted and embedded directly where needed, allowing the constant file to be completely removed while preserving all functionality.
Solution Approach 2:
The patent extracts individual constant values from the constant object and removes the entire constant file after inlining. The build tool traverses the dependency graph, identifies constants used by other modules, extracts their values, and replaces imports with direct value assignments, thereby taking out and eliminating the unnecessary constant file.
2Reliability
If constant files are included in the bundle, then completeness of executable files is maintained, but processing efficiency decreases
Solution Approach 1:
The patent performs constant inlining as a preliminary action during the build process, before the executable bundle is created. By traversing the dependency graph and inlining constants upfront, the system ensures all necessary values are embedded in the remaining files, making the constant file unnecessary for execution while maintaining completeness.
Solution Approach 2:
The patent copies constant values from the constant file and embeds them directly into the importing modules. Instead of referencing the constant file during execution, each module receives the actual constant values as direct assignments, eliminating the need to load and process the separate constant file while preserving all data.
3Quantity of substance
If large constant files are executed, then all necessary data is available, but download and execution time increases
Solution Approach 1:
The patent applies local quality by inlining constant values directly into the specific modules that need them. Each module receives only the constant values it requires, embedded locally within its own code, rather than loading a large centralized constant file. This reduces overall bundle size and eliminates unnecessary data transfer and processing for modules that don't use those constants.
Data Source
AI summary
Systems, methods, and computer-readable media for constant file replacement operations in a bundle of executable files are disclosed. Systems and methods may involve receiving a plurality of files, reading contents of an impure file in the plurality of files, identifying a link between the impure file and at least one pure file in the plurality of files, and reading contents of the at least one pure file to determine exported values. The at least one pure file may lack side effects. The impure file may be traversed to determine at least one reference to the at least one pure file and ascertaining at least one exported value referenced by the at least one pure file. Systems and methods may involve replacing the at least one reference in the impure file with the ascertained at least one exported value and unlinking the at least one pure file from the impure file.


