[svn:parrot] r38356 - trunk/tools/build

Infinoid at svn.parrot.org Infinoid at svn.parrot.org
Sat Apr 25 22:46:17 UTC 2009


Author: Infinoid
Date: Sat Apr 25 22:46:15 2009
New Revision: 38356
URL: https://trac.parrot.org/parrot/changeset/38356

Log:
[tools] Make c2str.pl stop using Math::BigInt, simplify the hash algorithm.
This speeds builds up parrot builds by 10 seconds (8%) for me.

Modified:
   trunk/tools/build/c2str.pl

Modified: trunk/tools/build/c2str.pl
==============================================================================
--- trunk/tools/build/c2str.pl	Sat Apr 25 20:40:18 2009	(r38355)
+++ trunk/tools/build/c2str.pl	Sat Apr 25 22:46:15 2009	(r38356)
@@ -15,7 +15,6 @@
 
 use Fcntl qw( :DEFAULT :flock );
 use Text::Balanced qw(extract_delimited);
-use Math::BigInt ();
 use Getopt::Long ();
 use IO::File ();
 
@@ -69,13 +68,12 @@
 }
 
 sub hash_val {
-    my $h = Math::BigInt->new('+0');
+    my $h = 0;
     my $s = shift;
     for ( my $i = 0 ; $i < length($s) ; ++$i ) {
+        $h &= 0x03ffffff;
         $h += $h << 5;
-        $h &= 0xffffffff;
-        $h += ord substr( $s, $i, 1 );
-        $h &= 0xffffffff;
+        $h ^= ord substr( $s, $i, 1 );
     }
     return sprintf( "0x%x", $h );
 }


More information about the parrot-commits mailing list