This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
move perf test from re/pat.t to re/speed.t
authorDavid Mitchell <davem@iabyn.com>
Sat, 9 Apr 2016 15:43:20 +0000 (16:43 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sat, 9 Apr 2016 15:43:20 +0000 (16:43 +0100)
These days we generally put re tests which rely on timing in a separate
file, t/re/speed.t; move a recently-added test there.

t/re/pat.t
t/re/speed.t

index 73eadd9..295a9f7 100644 (file)
@@ -23,7 +23,7 @@ BEGIN {
     skip_all_without_unicode_tables();
 }
 
-plan tests => 790;  # Update this when adding/deleting tests.
+plan tests => 789;  # Update this when adding/deleting tests.
 
 run_tests() unless caller;
 
@@ -1758,17 +1758,6 @@ EOP
                 fresh_perl_is($code, $expect, {}, "$bug - $test_name" );
             }
         }
-        {
-            # [perl #127855] Slowdown in m//g on COW strings of certain lengths
-            my $elapsed= -time;
-            my $len= 4e6;
-            my $zeros= 40000;
-            my $str= ( "0" x $zeros ) . ( "1" x ( $len - $zeros ) );
-            my $substr= substr( $str, 1 );
-            1 while $substr=~m/0/g;
-            $elapsed += time;
-            ok( $elapsed <= 1, "should not COW on long string with substr and m//g");
-        }
 } # End of sub run_tests
 
 1;
index 28d4dbb..648f2e9 100644 (file)
@@ -23,7 +23,7 @@ BEGIN {
     skip_all_without_unicode_tables();
 }
 
-plan tests => 57;  #** update watchdog timeouts proportionally when adding tests
+plan tests => 58;  #** update watchdog timeouts proportionally when adding tests
 
 use strict;
 use warnings;
@@ -140,6 +140,20 @@ PROG
         }
     }
 
+    {
+        # [perl #127855] Slowdown in m//g on COW strings of certain lengths
+        # this should take milliseconds, but took 10's of seconds.
+        my $elapsed= -time;
+        my $len= 4e6;
+        my $zeros= 40000;
+        my $str= ( "0" x $zeros ) . ( "1" x ( $len - $zeros ) );
+        my $substr= substr( $str, 1 );
+        1 while $substr=~m/0/g;
+        $elapsed += time;
+        ok( $elapsed <= 1, "should not COW on long string with substr and m//g");
+    }
+
+
 } # End of sub run_tests
 
 1;