Just-in-time Compilation for Discrete Event Simulation Speed
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current discrete event simulation methods face challenges in executing large or complex simulations efficiently due to limitations in incorporating user-specific conditions and state changes, with existing frameworks often requiring manual compilation and resulting in slow execution speeds.
Innovation Solution
A method utilizing just-in-time compilation to integrate user-entered logic into discrete event simulation models, allowing dynamic generation of high-speed code blocks associated with events by compiling and linking code blocks into a customized dynamic link library within the simulation program.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If manual compilation methods are used to integrate user-specific code into discrete event simulations, then complete customization of simulation logic is achieved, but execution speed decreases
Solution Approach 1:
The system performs preliminary compilation of user-specific code blocks into native machine code before execution. The just-in-time compiler compiles code blocks during simulation initialization or loading phases, converting high-level language code into optimized native code that executes at full speed during the simulation runtime, thus resolving the speed penalty of interpretation while maintaining customization.
Solution Approach 2:
The system dynamically changes the execution state of code blocks by tracking which blocks have been compiled and which remain uncompiled. It uses a compilation status parameter to manage the transition from uncompiled to compiled state, allowing the simulation to adapt its execution method based on the compilation status of each code block, thereby optimizing performance while maintaining flexibility.
2Productivity
If pre-compiled simulation frameworks are used, then execution speed is improved, but flexibility to incorporate user-specific conditions deteriorates
Solution Approach 1:
The simulation system is segmented into compiled core framework components and user-specific code blocks. The core simulation engine remains pre-compiled for high-speed execution, while user-specific logic is separated into individual code blocks that can be selectively compiled. This segmentation allows the system to maintain the speed of pre-compiled code while incorporating customizable user logic through the just-in-time compilation of specific code blocks.
Solution Approach 2:
The just-in-time compiler acts as an intermediary between user-written code and the simulation execution environment. It translates user-specific code blocks into native machine code that can be integrated with the pre-compiled simulation framework, serving as a bridge that enables both high-speed execution and full customization capability simultaneously.
3Ease of manufacture
If interpreted languages are used for user code integration, then ease of programming is improved, but simulation execution speed deteriorates
Solution Approach 1:
User code is compiled into native machine code during simulation loading or initialization rather than being interpreted during execution. This preliminary compilation action converts easy-to-write high-level code into high-speed native code before the simulation runs, eliminating the speed penalty of interpretation while preserving the programming ease of high-level languages.
Solution Approach 2:
The system substitutes the interpretation mechanism with a compilation mechanism. Instead of using an interpreter to execute user code line-by-line during simulation runtime, the just-in-time compiler translates user code into native machine code that executes directly on the processor, replacing the slow interpretation process with fast native execution while maintaining high-level programming syntax.
Data Source
AI summary
A method for a discrete event simulation model of a system utilizing a just-in-time compilation for one or more code blocks associated with an event in one or more discrete event simulation models is disclosed. The method comprises the steps of determining the event in a discrete event simulation model according to a kind of event, retrieving the code block associated with the event, compiling the code block into an object file using a compiler, linking the object file with a predetermined function in a simulation library, compiling the object file and the predetermined function into a customized dynamic link library, loading the customized dynamic link library (DLL) within a discrete event simulation program execution and linking the customized DLL to a simulation program. The method allows user entered logic to be executed in high speed by integrating a just-in-time compiler embedded into the simulation model to allow dynamic generation of high speed code blocks within one or more simulations.


