Runtime Code Caching for Managed Environment Performance

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

In managed environments, runtime-generated code is recompiled every time a program runs, leading to performance inefficiencies due to the need for intermediate byte code generation and translation to native machine instructions, which can be costly in terms of processing resources.

Innovation Solution

Implementing a caching mechanism that identifies and stores runtime-generated code with unique identifiers, allowing it to be retrieved and reused across program instances, thereby bypassing the need for repeated code generation and translation.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If runtime-generated code is recompiled every time a program runs, then the code can be executed with up-to-date optimizations, but performance deteriorates due to repeated code generation and translation overhead

Engineering Contradiction:
Improvecode execution accuracyVSAvoidexecution speed
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent applies preliminary action by pre-compiling runtime-generated code and storing it in a cache before execution. The compilation process is performed in advance during the first execution, and the compiled code is cached for reuse in subsequent executions, eliminating the need to recompile every time the program runs.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent uses copying by creating a cached copy of the compiled code from the intermediate byte code. Instead of recompiling the original source or byte code each time, the system creates and stores a compiled code copy that can be directly executed in subsequent runs, significantly reducing compilation overhead.

Inventive Principle:
Principle #26Copying

2Productivity

If a caching mechanism is implemented to store runtime-generated code, then execution speed improves by loading pre-cached code, but device complexity increases due to the caching infrastructure

Engineering Contradiction:
Improveexecution speedVSAvoidcaching mechanism complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The caching mechanism is implemented as a self-service system that automatically detects, compiles, caches, and retrieves code without requiring external intervention. The system monitors its own execution state, identifies runtime-generated code, and manages the caching process autonomously, reducing the need for complex external caching infrastructure.

Inventive Principle:
Principle #25Self-service

3Adaptability or versatility

If intermediate byte code is generated and translated to native instructions at runtime, then environment-specific optimizations can be applied, but processing overhead increases due to the compilation phase

Engineering Contradiction:
Improveenvironment-specific optimizationVSAvoidcompilation time
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

The patent applies preliminary action by performing the compilation of intermediate byte code to native instructions in advance during the first execution. The compiled code is then cached and reused in subsequent executions, eliminating the time-consuming compilation phase from repeated runtime operations while preserving environment-specific optimizations.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent uses copying by creating a cached copy of the compiled native code from the intermediate byte code. This copied compiled code is stored and reused in subsequent executions, avoiding the need to repeatedly translate byte code to native instructions while maintaining the benefits of environment-specific optimizations.

Inventive Principle:
Principle #26Copying

Data Source

PatentEP2340481B1Caching runtime generated code
Publication Date: 2018.06.13 MICROSOFT TECHNOLOGY LICENSING LLC
  • EP2340481B1 patent drawingFigure 1
  • EP2340481B1 patent drawingFigure 2a
  • EP2340481B1 patent drawingFigure 2b

AI summary

A program entity that generates code but that does not perturb global state is identified. Code produced by the identified program entity can be assigned an identifier and cached the first time it is executed. Subsequent executions of the program entity can eliminate generation of the code and/or translation of the generated code into native binary code. The runtime generated code and native binary code can be cached in a machine-wide cache, or can be added to the metadata of the assembly generated from the source code of the program entity.