[svn:parrot] r49090 - trunk/src
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Fri Sep 17 19:23:49 UTC 2010
Author: chromatic
Date: Fri Sep 17 19:23:49 2010
New Revision: 49090
URL: https://trac.parrot.org/parrot/changeset/49090
Log:
[hash] Optimized Parrot_hash_thaw().
Using the type-safe "Hey, I have a STRING key!" and "I have the bucket, now
what?" functions from the previous commit in this hot path improves hash
thawing for the most common case dramatically and Rakudo startup by some 2.5%.
Modified:
trunk/src/hash.c
Modified: trunk/src/hash.c
==============================================================================
--- trunk/src/hash.c Fri Sep 17 19:23:46 2010 (r49089)
+++ trunk/src/hash.c Fri Sep 17 19:23:49 2010 (r49090)
@@ -799,9 +799,13 @@
if (key_type == Hash_key_type_STRING
&& entry_type == enum_hash_int) {
for (entry_index = 0; entry_index < num_entries; ++entry_index) {
- STRING * const key = VTABLE_shift_string(interp, info);
- const INTVAL i = VTABLE_shift_integer(interp, info);
- parrot_hash_put(interp, hash, (void *)key, (void *)i);
+ STRING * const key = VTABLE_shift_string(interp, info);
+ const INTVAL i = VTABLE_shift_integer(interp, info);
+ const INTVAL hashval = key_hash_STRING(interp, key, hash->seed);
+ HashBucket *b = parrot_hash_get_bucket_string(interp, hash,
+ key, hashval);
+ parrot_hash_store_value_in_bucket(interp, hash, b, hashval,
+ (void *)key, (void *)i);
}
return hash;
More information about the parrot-commits
mailing list