|
Faster - do some things faster |
Faster - do some things faster
use Faster;
perl -MFaster ...
This module implements a very simple-minded JIT. It works by more or less translating every function it sees into a C program, compiling it and then replacing the function by the compiled code.
As a result, startup times are immense, as every function might lead to a full-blown compilation.
The speed improvements are also not great, you can expect 20% or so on average, for code that runs very often.
Faster is in the early stages of development. Due to its design its relatively safe to use (it will either work or simply slowdown the program immensely, but rarely cause bugs).
Usage is very easy, just use Faster and every function called from then
on will be compiled.
Right now, Faster will leave lots of *.c, *.o and *.so files in your $FASTER_CACHEDIR (by default $HOME/.perl-faster-cache), and it will even create those temporary files in an insecure manner, so watch out.
The following environment variables influence the behaviour of Faster:
0. Currently, 1 outputs which packages are being compiled, 3
outputs the cache directory and 10 outputs information on which perl
function is compiled into which shared object.
0. Currently, this
adds 1-3 assert's per perl op, to ensure that opcode order and C
execution order are compatible.
$HOME/.perl-faster-cache if HOME is set and a temporary
directory otherwise.
This directory will always grow in size, so you might need to erase it from time to time.
Perl will check much less often for asynchronous signals in Faster-compiled code. It tries to check on every function call, loop iteration and every I/O operator, though.
The following things will disable Faster. If you manage to enable them at runtime, bad things will happen. Enabling them at startup will be fine, though.
enabled tainting enabled debugging
Thread-enabled builds of perl will dramatically reduce Faster's performance, but you don't care about speed if you enable threads anyway.
These constructs will force the use of the interpreter for the currently executed function as soon as they are being encountered during execution.
goto next, redo (but not well-behaved last's) eval require any use of formats .., ... (flipflop operators)
Marc Lehmann <schmorp@schmorp.de> http://home.schmorp.de/
|
Faster - do some things faster |