… | |
… | |
5 | use Faster; |
5 | use Faster; |
6 | |
6 | |
7 | perl -MFaster ... |
7 | perl -MFaster ... |
8 | |
8 | |
9 | DESCRIPTION |
9 | DESCRIPTION |
10 | This module implements a very simple-minded JIT. It works by more or |
10 | This module implements a very simple-minded "JIT" (or actually AIT, |
11 | less translating every function it sees into a C program, compiling it |
11 | ahead of time compiler). It works by more or less translating every |
12 | and then replacing the function by the compiled code. |
12 | function it sees into a C program, compiling it and then replacing the |
|
|
13 | function by the compiled code. |
13 | |
14 | |
14 | As a result, startup times are immense, as every function might lead to |
15 | As a result, startup times are immense, as every function might lead to |
15 | a full-blown compilation. |
16 | a full-blown compilation. |
16 | |
17 | |
17 | The speed improvements are also not great, you can expect 20% or so on |
18 | The speed improvements are also not great, you can expect 20% or so on |
18 | average, for code that runs very often. |
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. |
19 | |
24 | |
20 | Faster is in the early stages of development. Due to its design its |
25 | Faster is in the early stages of development. Due to its design its |
21 | relatively safe to use (it will either work or simply slowdown the |
26 | relatively safe to use (it will either work or simply slowdown the |
22 | program immensely, but rarely cause bugs). |
27 | program immensely, but rarely cause bugs). |
23 | |
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 | |
24 | Usage is very easy, just "use Faster" and every function called from |
34 | Usage is very easy, just "use Faster" and every function called from |
25 | then on will be compiled. |
35 | then on will be compiled. |
26 | |
36 | |
27 | Right now, Faster will leave lots of *.c, *.o and *.so files in your |
37 | Right now, Faster can leave lots of *.c and *.so files in your |
28 | $FASTER_CACHEDIR (by default $HOME/.perl-faster-cache), and it will even |
38 | $FASTER_CACHEDIR (by default $HOME/.perl-faster-cache), and it will even |
29 | create those temporary files in an insecure manner, so watch out. |
39 | create those temporary files in an insecure manner, so watch out. |
30 | |
40 | |
31 | ENVIRONMENT VARIABLES |
41 | ENVIRONMENT VARIABLES |
32 | The following environment variables influence the behaviour of Faster: |
42 | The following environment variables influence the behaviour of Faster: |
… | |
… | |
37 | compiled, 3 outputs the cache directory and 10 outputs information |
47 | compiled, 3 outputs the cache directory and 10 outputs information |
38 | on which perl function is compiled into which shared object. |
48 | on which perl function is compiled into which shared object. |
39 | |
49 | |
40 | FASTER_DEBUG |
50 | FASTER_DEBUG |
41 | Add debugging code when set to values higher than 0. Currently, this |
51 | Add debugging code when set to values higher than 0. Currently, this |
42 | adds 1-3 "assert"'s per perl op, to ensure that opcode order and C |
52 | adds 1-3 "assert"'s per perl op (FASTER_DEBUG > 1), to ensure that |
43 | execution order are compatible. |
53 | opcode order and C execution order are compatible. |
44 | |
54 | |
45 | FASTER_CACHE |
55 | FASTER_CACHE |
46 | Set a persistent cache directory that caches compiled code |
56 | Set a persistent cache directory that caches compiled code |
47 | fragments. The default is "$HOME/.perl-faster-cache" if "HOME" is |
57 | fragments. The default is "$HOME/.perl-faster-cache" if "HOME" is |
48 | set and a temporary directory otherwise. |
58 | set and a temporary directory otherwise. |
… | |
… | |
70 | executed function as soon as they are being encountered during |
80 | executed function as soon as they are being encountered during |
71 | execution. |
81 | execution. |
72 | |
82 | |
73 | goto |
83 | goto |
74 | next, redo (but not well-behaved last's) |
84 | next, redo (but not well-behaved last's) |
|
|
85 | labels, if used |
75 | eval |
86 | eval |
76 | require |
87 | require |
77 | any use of formats |
88 | any use of formats |
78 | .., ... (flipflop operators) |
89 | .., ... (flipflop operators) |
79 | |
90 | |