diff options
author | David Mitchell <davem@iabyn.com> | 2014-11-14 12:18:12 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2014-11-29 23:16:54 +0000 |
commit | 9e7973fa06e83f9e8592f277685d066e2ff6abef (patch) | |
tree | 68433a64a990490ca494d1c25011beb99a868814 /pod/perlhack.pod | |
parent | 8b4fb3c6d41d4b5fcb35eae18a732259a0ebce34 (diff) | |
download | perl-9e7973fa06e83f9e8592f277685d066e2ff6abef.tar.gz |
add Porting/bench.pl
This tool runs code snippets found in t/perf/benchmarks (or similar) under
cachegrind, in order to calculate how many instruction reads, data writes,
branches, cache misses, etc. that one execution of the snippet uses. It
will run them against two or more perl executables and show how much each
test has gotten better or worse.
It is modelled on the perlbench tool, but since it measures instruction
reads etc., rather than timings, it is much more precise and reproducible.
It is also considerably faster, and is capable or running tests in
parallel. Rather than displaying a single relative percentage per
test/perl combination, it displays values for 13 different measurements,
such as instruction reads, conditional branch misses etc.
This commit also changes the format of t/perf/benchmarks slightly; it
becomes an AoH rather than a HoH (to allow checking for duplicate keys),
and the test names themselves become a :: hierarchy.
Diffstat (limited to 'pod/perlhack.pod')
-rw-r--r-- | pod/perlhack.pod | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/pod/perlhack.pod b/pod/perlhack.pod index 8fcd618a8d..b966542a3c 100644 --- a/pod/perlhack.pod +++ b/pod/perlhack.pod @@ -961,6 +961,27 @@ available memory can be run safely. See also the documentation for the Test and Test::Harness modules, for more environment variables that affect testing. +=head2 Performance testing + +The file F<t/perf/benchmarks> contains snippets of perl code which are +intended to be benchmarked across a range of perls by the +F<Porting/bench.pl> tool. If you fix or enhance a performance issue, you +may want to add a representative code sample to the file, then run +F<bench.pl> against the previous and current perls to see what difference +it has made, and whether anything else has slowed down as a consequence. + +The file F<t/perf/opcount.t> is designed to test whether a particular +code snippet has been compiled into an optree containing specified +numbers of particular op types. This is good for testing whether +optimisations which alter ops, such as converting an C<aelem> op into an +C<aelemfast> op, are really doing that. + +The files F<t/perf/speed.t> and F<t/re/speed.t> are designed to test +things that run thousands of times slower if a particular optimisation +is broken (for example, the utf8 length cache on long utf8 strings). +Add a test that will take a fraction of a second normally, and minutes +otherwise, causing the test file to time out on failure. + =head1 MORE READING FOR GUTS HACKERS To hack on the Perl guts, you'll need to read the following things: |