| 1 |
NAME |
| 2 |
Faster - do some things faster |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
use Faster; |
| 6 |
|
| 7 |
perl -MFaster ... |
| 8 |
|
| 9 |
DESCRIPTION |
| 10 |
This module implements a very simple-minded "JIT" (or actually AIT, |
| 11 |
ahead of time compiler). It works by more or less translating every |
| 12 |
function it sees into a C program, compiling it and then replacing the |
| 13 |
function by the compiled code. |
| 14 |
|
| 15 |
As a result, startup times are immense, as every function might lead to |
| 16 |
a full-blown compilation. |
| 17 |
|
| 18 |
The speed improvements are also not great, you can expect 20% or so on |
| 19 |
average, for code that runs very often. The reason for this is that data |
| 20 |
handling is mostly being done by the same old code, it just gets called |
| 21 |
a bit faster. Regexes and string operations won't get faster. Airhtmetic |
| 22 |
doresn't become any faster. Just the operands and other stuff is put on |
| 23 |
the stack faster, and the opcodes themselves have a bit less overhead. |
| 24 |
|
| 25 |
Faster is in the early stages of development. Due to its design its |
| 26 |
relatively safe to use (it will either work or simply slowdown the |
| 27 |
program immensely, but rarely cause bugs). |
| 28 |
|
| 29 |
More intelligent algorithms (loop optimisation, type inference) could |
| 30 |
improve that easily, but requires a much more elaborate presentation and |
| 31 |
optimiser than what is in place. There are no plans to improve Faster in |
| 32 |
this way, yet, but it would provide a reasonably good place to start. |
| 33 |
|
| 34 |
Usage is very easy, just "use Faster" and every function called from |
| 35 |
then on will be compiled. |
| 36 |
|
| 37 |
Right now, Faster can leave lots of *.c and *.so files in your |
| 38 |
$FASTER_CACHEDIR (by default $HOME/.perl-faster-cache), and it will even |
| 39 |
create those temporary files in an insecure manner, so watch out. |
| 40 |
|
| 41 |
ENVIRONMENT VARIABLES |
| 42 |
The following environment variables influence the behaviour of Faster: |
| 43 |
|
| 44 |
FASTER_VERBOSE |
| 45 |
Faster will output more informational messages when set to values |
| 46 |
higher than 0. Currently, 1 outputs which packages are being |
| 47 |
compiled, 3 outputs the cache directory and 10 outputs information |
| 48 |
on which perl function is compiled into which shared object. |
| 49 |
|
| 50 |
FASTER_DEBUG |
| 51 |
Add debugging code when set to values higher than 0. Currently, this |
| 52 |
adds 1-3 "assert"'s per perl op (FASTER_DEBUG > 1), to ensure that |
| 53 |
opcode order and C execution order are compatible. |
| 54 |
|
| 55 |
FASTER_CACHE |
| 56 |
Set a persistent cache directory that caches compiled code |
| 57 |
fragments. The default is "$HOME/.perl-faster-cache" if "HOME" is |
| 58 |
set and a temporary directory otherwise. |
| 59 |
|
| 60 |
This directory will always grow in size, so you might need to erase |
| 61 |
it from time to time. |
| 62 |
|
| 63 |
BUGS/LIMITATIONS |
| 64 |
Perl will check much less often for asynchronous signals in |
| 65 |
Faster-compiled code. It tries to check on every function call, loop |
| 66 |
iteration and every I/O operator, though. |
| 67 |
|
| 68 |
The following things will disable Faster. If you manage to enable them |
| 69 |
at runtime, bad things will happen. Enabling them at startup will be |
| 70 |
fine, though. |
| 71 |
|
| 72 |
enabled tainting |
| 73 |
enabled debugging |
| 74 |
|
| 75 |
Thread-enabled builds of perl will dramatically reduce Faster's |
| 76 |
performance, but you don't care about speed if you enable threads |
| 77 |
anyway. |
| 78 |
|
| 79 |
These constructs will force the use of the interpreter for the currently |
| 80 |
executed function as soon as they are being encountered during |
| 81 |
execution. |
| 82 |
|
| 83 |
goto |
| 84 |
next, redo (but not well-behaved last's) |
| 85 |
labels, if used |
| 86 |
eval |
| 87 |
require |
| 88 |
any use of formats |
| 89 |
.., ... (flipflop operators) |
| 90 |
|
| 91 |
AUTHOR |
| 92 |
Marc Lehmann <schmorp@schmorp.de> |
| 93 |
http://home.schmorp.de/ |
| 94 |
|