In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/3deca554c91ecb8309424e4f088fdde80e21248b?hp=8ef5f0698395e173e3e7fc6397d5846e1c5d59d0>

- Log -----------------------------------------------------------------
commit 3deca554c91ecb8309424e4f088fdde80e21248b
Author: Yves Orton <[email protected]>
Date:   Sun Mar 26 19:12:51 2017 +0200

    do not overallocate in zaphod32_hash
    
    We don't use it, but it should be fixed regardless to sync
    with upstream which might.

M       zaphod32_hash.h

commit 0e2b709f3c34710a60d9a8673dac62116c3e259c
Author: Yves Orton <[email protected]>
Date:   Fri Mar 24 14:33:36 2017 +0100

    remove unneeded an unwelcome dependency
    
    I added this when debugging the load average change and forgot to remove it
    afterwards, and it upsets Jarkkos test suite.

M       t/op/hash.t

commit ee172d48f1de7778c3811ec1c03e3fa788443c74
Author: Yves Orton <[email protected]>
Date:   Thu Mar 23 22:06:51 2017 +0100

    Porting/bench.pl: allow more than one file to be read at a go

M       Porting/bench.pl
-----------------------------------------------------------------------

Summary of changes:
 Porting/bench.pl | 45 ++++++++++++++++++++++++++++++++++-----------
 t/op/hash.t      |  1 -
 zaphod32_hash.h  | 16 +++++++++-------
 3 files changed, 43 insertions(+), 19 deletions(-)

diff --git a/Porting/bench.pl b/Porting/bench.pl
index efff214e7a..840d7231d0 100755
--- a/Porting/bench.pl
+++ b/Porting/bench.pl
@@ -392,7 +392,7 @@ my %OPTS = (
         'norm=s'      => \$OPTS{norm},
         'perlargs=s'  => \$OPTS{perlargs},
         'raw'         => \$OPTS{raw},
-        'read|r=s'    => \$OPTS{read},
+        'read|r=s@'   => \$OPTS{read},
         'show!'       => \$OPTS{show},
         'sort=s'      => \$OPTS{sort},
         'tests=s'     => \$OPTS{tests},
@@ -679,25 +679,48 @@ sub do_grind {
             if $bisect_min > $bisect_max;
     }
 
-    if ($OPTS{read}) {
-        open my $in, '<:encoding(UTF-8)', $OPTS{read}
-            or die " Error: can't open '$OPTS{read}' for reading: $!\n";
+    foreach my $file (@{$OPTS{read}}) {
+        open my $in, '<:encoding(UTF-8)', $file
+            or die " Error: can't open '$file' for reading: $!\n";
         my $data = do { local $/; <$in> };
         close $in;
 
         my $hash = JSON::PP::decode_json($data);
         if (int($FORMAT_VERSION) < int($hash->{version})) {
             die "Error: unsupported version $hash->{version} in file"
-              . "'$OPTS{read}' (too new)\n";
+              . "'$file' (too new)\n";
         }
-        ($loop_counts, $perls, $results, $tests, $order) =
+        my ($read_loop_counts, $read_perls, $read_results, $read_tests, 
$read_order) =
             @$hash{qw(loop_counts perls results tests order)};
+        filter_tests($read_results);
+        filter_tests($read_tests);
+        if (!$read_order) {
+            $order = [ sort keys %$read_tests ];
+        }
+        if (!$loop_counts) {
+            ($loop_counts, $perls, $results, $tests, $order) =
+                ($read_loop_counts, $read_perls, $read_results, $read_tests, 
$read_order);
+            filter_tests($results);
+            filter_tests($tests);
+            if (!$order) {
+                $order = [ sort keys %$tests ];
+            }
+        } else {
+            my @have_keys= sort keys %$read_tests;
+            my @want_keys= sort keys %$tests;
+
+            if ("@have_keys" ne "@want_keys" or
+                "@$read_loop_counts" ne "@$loop_counts")
+            {
+                die "tests run aren't the same, cant merge read files";
+            }
 
-        filter_tests($results);
-        filter_tests($tests);
-
-        if (!$order) {
-            $order = [ sort keys %$tests ];
+            push @$perls, @{$hash->{perls}};
+            foreach my $test (keys %{$hash->{results}}) {
+                foreach my $perl (keys %{$hash->{results}{$test}}) {
+                    $results->{$test}{$perl}= $hash->{results}{$test}{$perl};
+                }
+            }
         }
     }
 
diff --git a/t/op/hash.t b/t/op/hash.t
index 0551e03ca2..dc8fcc9871 100644
--- a/t/op/hash.t
+++ b/t/op/hash.t
@@ -179,7 +179,6 @@ sub torture_hash {
 
     # Each time this will get emptied then repopulated. If the fill isn't reset
     # when the hash is emptied, the used count will likely exceed the array
-    use Devel::Peek;
     %$h3 = %$h2;
     is(join(",", sort keys %$h3),join(",",sort keys %$h2),"$desc (+$count 
copy) has same keys");
     my (undef, $total3) = validate_hash("$desc (+$count copy)", $h3);
diff --git a/zaphod32_hash.h b/zaphod32_hash.h
index 9ce1a63ad1..ec091f723c 100644
--- a/zaphod32_hash.h
+++ b/zaphod32_hash.h
@@ -154,6 +154,7 @@ void zaphod32_seed_state (
     ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
     ZAPHOD32_SCRAMBLE32(state[1],0xaa6f908d);
     ZAPHOD32_SCRAMBLE32(state[2],0xcdf6b72d);
+
     /* now that we have scrambled we do some mixing to avalanche the
      * state bits to gether */
     ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE A 1/4");
@@ -165,12 +166,13 @@ void zaphod32_seed_state (
     ZAPHOD32_SCRAMBLE32(state[0],0xc95d22a9);
     ZAPHOD32_SCRAMBLE32(state[1],0x8497242b);
     ZAPHOD32_SCRAMBLE32(state[2],0x9c5cc4e9);
-    /* and one final mix */
-    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE 3/3");
-    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE 3/3");
-    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE 3/3");
-    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE 3/3");
-    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE 3/3");
+
+    /* and a thorough final mix */
+    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE B 1/5");
+    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE B 2/5");
+    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE B 3/5");
+    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE B 4/5");
+    ZAPHOD32_MIX(state[0],state[1],state[2],"ZAPHOD32 SEED-STATE B 5/5");
 
 }
 
@@ -277,7 +279,7 @@ ZAPHOD32_STATIC_INLINE U32 zaphod32_hash(
     const U8 *key,
     const STRLEN key_len
 ) {
-    U32 state[1796];
+    U32 state[3];
     zaphod32_seed_state(seed_ch,(U8*)state);
     return zaphod32_hash_with_state((U8*)state,key,key_len);
 }

--
Perl5 Master Repository

Reply via email to