다음: Miscellaneous Techniques, 이전: Accumulation, 상위 문서: Vectorization and Faster Code Execution [차례][찾아보기]
Vectorization is the preferred technique for eliminating loops and speeding up code. Nevertheless, it is not always possible to replace every loop. In such situations it may be worth trying Octave’s experimental Just-In-Time (JIT) compiler.
A JIT compiler works by analyzing the body of a loop, translating the Octave statements into another language, compiling the new code segment into an executable, and then running the executable and collecting any results. The process is not simple and there is a significant amount of work to perform for each step. It can still make sense, however, if the number of loop iterations is large. Because Octave is an interpreted language every time through a loop Octave must parse the statements in the loop body before executing them. With a JIT compiler this is done just once when the body is translated to another language.
The JIT compiler is a very new feature in Octave and not all valid Octave
statements can currently be accelerated. However, if no other technique
is available it may be worth benchmarking the code with JIT enabled. The
function jit_enable
is used to turn compilation on or off. The
function jit_startcnt
sets the threshold for acceleration. Loops
with iteration counts above jit_startcnt
will be accelerated. The
functions jit_failcnt
and debug_jit
are not likely to be of use
to anyone not working directly on the implementation of the JIT compiler.
Query or set the internal variable that enables Octave’s JIT compiler.
함수 안에서 "local"
선택지를 넣어 부르면, 함수와 함수가 부른 종속 절차의 변수가 지역적으로 바뀝니다. 함수가 종료되면 원래 변숫값이 되돌아옵니다.
같이 보기: jit_startcnt, debug_jit.
Query or set the internal variable that determines whether JIT compilation will take place for a specific loop.
Because compilation is a costly operation it does not make sense to employ JIT when the loop count is low. By default only loops with greater than 1000 iterations will be accelerated.
함수 안에서 "local"
선택지를 넣어 부르면, 함수와 함수가 부른 종속 절차의 변수가 지역적으로 바뀝니다. 함수가 종료되면 원래 변숫값이 되돌아옵니다.
같이 보기: jit_enable, jit_failcnt, debug_jit.
Query or set the internal variable that counts the number of JIT fail exceptions for Octave’s JIT compiler.
함수 안에서 "local"
선택지를 넣어 부르면, 함수와 함수가 부른 종속 절차의 변수가 지역적으로 바뀝니다. 함수가 종료되면 원래 변숫값이 되돌아옵니다.
같이 보기: jit_enable, jit_startcnt, debug_jit.
Query or set the internal variable that determines whether debugging/tracing is enabled for Octave’s JIT compiler.
함수 안에서 "local"
선택지를 넣어 부르면, 함수와 함수가 부른 종속 절차의 변수가 지역적으로 바뀝니다. 함수가 종료되면 원래 변숫값이 되돌아옵니다.
같이 보기: jit_enable, jit_startcnt.
다음: Miscellaneous Techniques, 이전: Accumulation, 상위 문서: Vectorization and Faster Code Execution [차례][찾아보기]