this is for holding javascript data
Daniele Cono D'Elia edited case-study.tex
over 8 years ago
Commit id: 25fee3424f1467cc1c664d2acadf65a3a9a4b008
deletions | additions
diff --git a/case-study.tex b/case-study.tex
index 718d4ab..5c397f8 100644
--- a/case-study.tex
+++ b/case-study.tex
...
\section{Case Study}
\label{case-study}
MATLAB is a popular dynamic language for scientific and numerical programming. Introduced in the late 1970s mainly as a scripting language for performing computations through efficient libraries, it has evolved over the years into a more complex programming language with support for high-level features such as functions, packages and object orientation. A popular feature of the language is the \feval\ construct, a built-in higher-order function that enables the invocation of the function
passed specified as first argument
on with the
set of subsequent remaining arguments
of for the \feval\ call,
and to return returning eventually the computed result. This feature is heavily used in many classes of numerical computations, such as iterative methods for
the approximation of the solution approximate solutions of an ordinary differential equation (ODE) and simulated annealing heuristics to locate a good approximation to the global optimum of a function in a large search space.
A previous study by Lameed and Hendren~\cite{lameed2013feval} shows that the overhead of an \feval\ call is significantly high compared to a direct call, especially in JIT-based execution environments such as McVM and the proprietary MATLAB JIT accelerator by Mathworks.
The main reason for this overhead is that In fact, the presence of an \feval\ instruction can disrupt the results of intra- and inter-procedural level for type and array shape inference analyses, which are
a key
ingredient factors for efficient code generation.
Lameed and Hendren thus propose and implement in McVM two dynamic techniques for optimizing \feval\ instructions. The first
technique one is based on OSR: using the McOSR library~\cite{lameed2013modular}, \feval\ calls inside loops are instrumented with an OSR point and
with profiling code to cache the last-known types for the arguments of each \feval\ instruction. When an OSR is fired at run-time, a code generator modifies the original function by inserting a guard to choose between a fast path containing a direct call and a slow path with the original \feval\ call. The second technique is less general and uses value-based JIT compilation: when the first argument of an \feval\ call is an argument of the enclosing function, the compiler replaces each call to this function in all of its callers with a call to a special dispatcher. When the program is executed, the dispatcher will evaluate the value of the parameter for the \feval\ and execute either a previously compiled cached code or generate and JIT-compile a method optimized for the current value of the argument.
Although the OSR-based approach is more general, it generates much less efficient code compared to the JIT-based version for three reasons:
\begin{enumerate}