1Devel::GoFaster(3) User Contributed Perl Documentation Devel::GoFaster(3)
2
3
4
6 Devel::GoFaster - optimise executable Perl ops
7
9 use Devel::GoFaster;
10
11 use Devel::GoFaster "global";
12
14 This module implements some optimisations in compiled Perl code, which
15 should make it run slightly faster without visibly affecting behaviour.
16 The optimisations are applied at the peephole optimisation step,
17 augmenting Perl's built-in optimisations.
18
19 Code to be made faster does not need to be written in any special way;
20 this module can generally be applied to code that was not written with
21 it in mind. However, to help with situations where the op munging
22 causes trouble (such as with the deparser), there is some selectivity
23 in which code gets the optimisations. Whether to apply these
24 optimisations is decided for each subroutine as a whole: it cannot be
25 enabled or disabled for just part of a subroutine. There is a global
26 control, defaulting to off, and lexically-scoped local control which
27 takes precedence over the global control.
28
29 Because the optimisations are applied in the peephole optimiser, not
30 affecting primary compilation, they are invisible to most modules that
31 muck around with op trees during compilation. So this module should
32 play nicely with modules that use custom ops and the like. However,
33 anything that examines the ops of a complete compiled subroutine is
34 liable to see the non-standard optimised ops from this module, and may
35 have a problem. In particular, the deparser can't correctly deparse
36 code that has been affected by this module. If such problems affect a
37 particular subroutine, the lexical control can be used to disable non-
38 standard optimisation of that subroutine alone.
39
40 This module tries quite hard to not visibly fail, so that it should be
41 generally safe to use its pragmata. If circumstances make it
42 impossible to apply optimisations that would sometimes be available,
43 the module will silently leave code unoptimised. In particular,
44 because all the optimisations are necessarily implemented using XS
45 code, on any system that can't build or load XS modules this module's
46 pragmata effectively become no-ops. No particular optimisations are
47 guaranteed by invoking this module.
48
50 use Devel::GoFaster
51 Locally enable the optimisations of this module. Subroutines
52 compiled in the lexical scope of this pragma will get the non-
53 standard optimisations, regardless of the global pragma state.
54
55 no Devel::GoFaster
56 Locally disable the optimisations of this module. Subroutines
57 compiled in the lexical scope of this pragma will not get the non-
58 standard optimisations, regardless of the global pragma state.
59
60 use Devel::GoFaster "global"
61 Globally enable the optimisations of this module. Subroutines
62 compiled after this pragma has been encountered will get the non-
63 standard optimisations, except where locally overridden.
64
65 no Devel::GoFaster "global"
66 Globally disable the optimisations of this module (which is the
67 default state). Subroutines compiled after this pragma has been
68 encountered will not get the non-standard optimisations, except
69 where locally overridden.
70
72 As noted above, this module is liable to break anything that examines
73 the ops of a complete compiled subroutine, such as the deparser.
74
76 Andrew Main (Zefram) <zefram@fysh.org>
77
79 Copyright (C) 2015, 2017 Andrew Main (Zefram) <zefram@fysh.org>
80
82 This module is free software; you can redistribute it and/or modify it
83 under the same terms as Perl itself.
84
85
86
87perl v5.32.0 2020-07-28 Devel::GoFaster(3)