Mercurial > hg > octave-shane
changeset 16878:011119bf4868
doc: Add jit_enable() and debug_jit() to manual.
* doc/interpreter/octave.texi: Add @menu item JIT Compiler.
* doc/interpreter/vectorize.txi: Add JIT Compiler node with
explanation of JIT. Add DOCSTRING entries for jit_enable and debug_jit.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 30 Jun 2013 15:50:16 -0700 |
parents | 5482cd26311a |
children | cc3743a91652 |
files | doc/interpreter/octave.texi doc/interpreter/vectorize.txi |
diffstat | 2 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/octave.texi +++ b/doc/interpreter/octave.texi @@ -600,6 +600,7 @@ * Broadcasting:: Broadcasting operations * Function Application:: Applying functions to arrays, cells, and structs * Accumulation:: Accumulation functions +* JIT Compiler:: Just-In-Time Compiler for loops * Miscellaneous Techniques:: Other techniques for speeding up code * Examples::
--- a/doc/interpreter/vectorize.txi +++ b/doc/interpreter/vectorize.txi @@ -42,6 +42,7 @@ * Broadcasting:: Broadcasting operations * Function Application:: Applying functions to arrays, cells, and structs * Accumulation:: Accumulation functions +* JIT Compiler:: Just-In-Time Compiler for loops * Miscellaneous Techniques:: Other techniques for speeding up code * Examples:: @end menu @@ -506,6 +507,35 @@ @DOCSTRING(accumdim) +@node JIT Compiler +@section JIT Compiler + +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 @strong{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 loop counter is a +large number. 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 @code{jit_enable} is used to turn compilation on or off. The function +@code{debug_jit} is not likely to be of use to anyone not working directly on +the implementation of the JIT compiler. + +@DOCSTRING(jit_enable) + +@DOCSTRING(debug_jit) + @node Miscellaneous Techniques @section Miscellaneous Techniques @cindex execution speed