xref: /openbsd-src/gnu/usr.bin/perl/t/perf/speed.t (revision 5486feefcc8cb79b19e014ab332cc5dfd05b3b33)
1b8851fccSafresh1#!./perl
2b8851fccSafresh1#
3b8851fccSafresh1# All the tests in this file are ones that run exceptionally slowly
4b8851fccSafresh1# (each test taking seconds or even minutes) in the absence of particular
5b8851fccSafresh1# optimisations. Thus it is a sort of canary for optimisations being
6b8851fccSafresh1# broken.
7b8851fccSafresh1#
8b8851fccSafresh1# Although it includes a watchdog timeout, this is set to a generous limit
9b8851fccSafresh1# to allow for running on slow systems; therefore a broken optimisation
10b8851fccSafresh1# might be indicated merely by this test file taking unusually long to
11b8851fccSafresh1# run, rather than actually timing out.
12b8851fccSafresh1#
13b8851fccSafresh1
14b8851fccSafresh1use strict;
15b8851fccSafresh1use warnings;
16b8851fccSafresh1use 5.010;
17b8851fccSafresh1
18b8851fccSafresh1sub run_tests;
19b8851fccSafresh1
20b8851fccSafresh1$| = 1;
21b8851fccSafresh1
22b8851fccSafresh1
23b8851fccSafresh1BEGIN {
24b8851fccSafresh1    chdir 't' if -d 't';
25b8851fccSafresh1    @INC = ('../lib');
26*5486feefSafresh1    require Config; Config->import;
27b8851fccSafresh1    require './test.pl';
28b8851fccSafresh1}
29b8851fccSafresh1
30b8851fccSafresh1plan tests => 1;
31b8851fccSafresh1
32b8851fccSafresh1use warnings;
33b8851fccSafresh1use strict;
34b8851fccSafresh1
35b8851fccSafresh1watchdog(60);
36b8851fccSafresh1
37b8851fccSafresh1SKIP: {
38b8851fccSafresh1    # RT #121975 COW speedup lost after e8c6a474
39b8851fccSafresh1
40b8851fccSafresh1    # without COW, this test takes minutes; with COW, its less than a
41b8851fccSafresh1    # second
42b8851fccSafresh1    #
43b8851fccSafresh1    skip  "PERL_NO_COW", 1 if $Config{ccflags} =~ /PERL_NO_COW/;
44b8851fccSafresh1
45b8851fccSafresh1    my ($x, $y);
46b8851fccSafresh1    $x = "x" x 1_000_000;
47b8851fccSafresh1    $y = $x for 1..1_000_000;
48b8851fccSafresh1    pass("COW 1Mb strings");
49b8851fccSafresh1}
50b8851fccSafresh1
51b8851fccSafresh11;
52