Code Optimization Bypassing Data Conversion Overhead
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In programming languages like Scala and Java, data representation of variables or objects in user programs differs from the data representation in memory regions managed by platforms or frameworks, leading to performance bottlenecks due to data conversion requirements.
Innovation Solution
A method that identifies code portions accessing primitive values in user-defined functions, converts them to directly reference the internal data representation of the user program, and generates calling code to execute the converted functions, thereby bypassing unnecessary data conversion.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If data conversion is performed between user program data representation and framework-managed memory data representation, then compatibility between user programs and framework is ensured, but execution speed deteriorates due to conversion overhead
Solution Approach 1:
The patent extracts and eliminates the data conversion step from the execution path by allowing user programs to directly reference framework-managed memory through generated code that bypasses conventional data representation boundaries. This removes the conversion overhead while maintaining compatibility through controlled code generation.
Solution Approach 2:
The patent introduces a code generation intermediary that translates user program references into direct memory access operations. This intermediary (the code generation system) mediates between user program data representations and framework-managed memory, creating optimized calling code that eliminates runtime conversion while preserving type safety and compatibility.
2Speed
If direct reference to internal data representation is implemented, then execution speed is improved by eliminating data conversion, but code complexity increases due to conversion logic
Solution Approach 1:
The patent performs code generation in advance during compilation or code preparation phases. The complex logic for creating direct memory references is executed beforehand, producing optimized calling code that appears simple at runtime. This preliminary action shifts complexity from runtime to build time.
Solution Approach 2:
The patent creates copied and adapted versions of user program code through the code generation process. Instead of modifying original user code directly, it generates new calling code that incorporates direct memory references, preserving the original code's simplicity while achieving performance improvements in the generated version.
Data Source
AI summary
A method includes identifying a code portion that accesses a primitive value in a user-defined function included in a user program, converting the code portion and an argument in a manner to directly reference an internal data representation of the user program, and generating a code for calling the user-defined function converted by the conversion.


