| 1 |
root |
1.1 |
NAME |
| 2 |
root |
1.2 |
Faster - do some things faster |
| 3 |
root |
1.1 |
|
| 4 |
|
|
SYNOPSIS |
| 5 |
root |
1.2 |
use Faster; |
| 6 |
|
|
|
| 7 |
|
|
perl -MFaster ... |
| 8 |
root |
1.1 |
|
| 9 |
|
|
DESCRIPTION |
| 10 |
root |
1.4 |
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 |
root |
1.2 |
|
| 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 |
root |
1.4 |
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 |
root |
1.2 |
|
| 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 |
root |
1.4 |
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 |
root |
1.2 |
Usage is very easy, just "use Faster" and every function called from |
| 35 |
|
|
then on will be compiled. |
| 36 |
|
|
|
| 37 |
root |
1.4 |
Right now, Faster can leave lots of *.c and *.so files in your |
| 38 |
root |
1.3 |
$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 |
root |
1.4 |
adds 1-3 "assert"'s per perl op (FASTER_DEBUG > 1), to ensure that |
| 53 |
|
|
opcode order and C execution order are compatible. |
| 54 |
root |
1.3 |
|
| 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 |
root |
1.2 |
|
| 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 |
root |
1.3 |
at runtime, bad things will happen. Enabling them at startup will be |
| 70 |
|
|
fine, though. |
| 71 |
root |
1.2 |
|
| 72 |
|
|
enabled tainting |
| 73 |
|
|
enabled debugging |
| 74 |
|
|
|
| 75 |
root |
1.3 |
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 |
root |
1.2 |
|
| 83 |
|
|
goto |
| 84 |
|
|
next, redo (but not well-behaved last's) |
| 85 |
root |
1.4 |
labels, if used |
| 86 |
root |
1.2 |
eval |
| 87 |
|
|
require |
| 88 |
|
|
any use of formats |
| 89 |
root |
1.3 |
.., ... (flipflop operators) |
| 90 |
root |
1.1 |
|
| 91 |
|
|
AUTHOR |
| 92 |
|
|
Marc Lehmann <schmorp@schmorp.de> |
| 93 |
|
|
http://home.schmorp.de/ |
| 94 |
|
|
|