[svn:parrot] r45197 - trunk/src/pmc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Sat Mar 27 01:37:50 UTC 2010


Author: chromatic
Date: Sat Mar 27 01:37:50 2010
New Revision: 45197
URL: https://trac.parrot.org/parrot/changeset/45197

Log:
[PMC] Optimized Hash's set_value_type() method slightly to avoid recreating
hashes unnecessarily.  It could use more optimization, probably by moving the
guts of the method into src/hash.c.

Modified:
   trunk/src/pmc/hash.pmc

Modified: trunk/src/pmc/hash.pmc
==============================================================================
--- trunk/src/pmc/hash.pmc	Sat Mar 27 01:23:00 2010	(r45196)
+++ trunk/src/pmc/hash.pmc	Sat Mar 27 01:37:50 2010	(r45197)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2001-2009, Parrot Foundation.
+Copyright (C) 2001-2010, Parrot Foundation.
 $Id$
 
 =head1 NAME
@@ -229,6 +229,9 @@
         It will create STRING* keys hash. Because we can't use STRING_compare
         directly - it declared static in F<src/hash.c>
         */
+        if (old_hash && old_hash->entry_type == type)
+            return;
+
         if (!old_hash)
             old_hash = parrot_new_hash(INTERP);
 


More information about the parrot-commits mailing list