This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add t/perf/benchmarks, t/perf/benchmarks.t
[perl5.git] / t / perf / benchmarks
CommitLineData
24fb648d
DM
1#!perl
2
3# This file specifies a hash-of-hashes that define snippets of code that
4# can be run by various measurement and profiling tools.
5#
6# The basic idea is that any time you add an optimisation that is intended
7# to make a particular construct faster, then you should add that construct
8# to this file.
9#
10# Under the normal test suite, the test file benchmarks.t does a basic
11# compile and run of each of these snippets; not to test performance,
12# but just to ensure that the code doesn't have errors.
13#
14# Over time, it is intended that various measurement and profiling tools
15# will be written that can run selected (or all) snippets in various
16# environments. These will not be run as part of a normal test suite run.
17#
18# This file is designed to be read in by 'do' (and in such a way that
19# multiple versions of this file from different releases can be read in
20# by a single process).
21#
22# Each key of the top-level hash is a token that describes a particular
23# test. Code will be compiled in the package named after the token, so it
24# should match /^\w+$/a. It is intended that this can be used on the
25# command line of tools to select particular tests, .
26#
27# Each value is also a hash, with three fields:
28#
29# desc is a description of the test
30# setup is a string containing setup code
31# code is a string containing the code to run in a loop
32#
33# So typically a benchmark tool might do something like
34#
35# eval "package $token; $setup; for (1..1000000) { $code }"
36
37
38{
39 arg_assignment => {
40 desc => 'assignment to local vars from @_',
41 setup => 'sub arg_assignment { my ($a, $b, $c) = @_ }',
42 code => 'arg_assignment(1,2,3)',
43 },
44};
45