[svn:parrot] r48334 - trunk/include/parrot
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Fri Aug 6 21:06:41 UTC 2010
Author: chromatic
Date: Fri Aug 6 21:06:40 2010
New Revision: 48334
URL: https://trac.parrot.org/parrot/changeset/48334
Log:
[hash] Use all allocated hash buckets, not 75%.
Now that hashes are 1/3 more memory efficient (yes, just like that), Parrot
reallocates hashes less frequently, which is good for speed. Here's a 2.489%
performance improvement for Rakudo startup.
Modified:
trunk/include/parrot/hash.h
Modified: trunk/include/parrot/hash.h
==============================================================================
--- trunk/include/parrot/hash.h Fri Aug 6 21:06:36 2010 (r48333)
+++ trunk/include/parrot/hash.h Fri Aug 6 21:06:40 2010 (r48334)
@@ -11,11 +11,11 @@
typedef enum {
enum_hash_undef,
- enum_hash_int = enum_type_INTVAL,
- enum_hash_num = enum_type_FLOATVAL,
+ enum_hash_int = enum_type_INTVAL,
+ enum_hash_num = enum_type_FLOATVAL,
enum_hash_string = enum_type_STRING,
- enum_hash_pmc = enum_type_PMC,
- enum_hash_ptr = enum_type_ptr
+ enum_hash_pmc = enum_type_PMC,
+ enum_hash_ptr = enum_type_ptr
} HashEntryType;
@@ -23,7 +23,7 @@
typedef UINTVAL BucketIndex;
#define INITBucketIndex ((BucketIndex)-2)
-#define N_BUCKETS(n) ((n) - (n)/4)
+#define N_BUCKETS(n) ((n))
#define HASH_ALLOC_SIZE(n) (N_BUCKETS(n) * sizeof (HashBucket) + \
(n) * sizeof (HashBucket *))
@@ -373,6 +373,19 @@
__attribute__nonnull__(4)
__attribute__nonnull__(5);
+PARROT_CANNOT_RETURN_NULL
+PARROT_WARN_UNUSED_RESULT
+PARROT_MALLOC
+Hash * parrot_create_hash_sized(PARROT_INTERP,
+ PARROT_DATA_TYPE val_type,
+ Hash_key_type hkey_type,
+ NOTNULL(hash_comp_fn compare),
+ NOTNULL(hash_hash_key_fn keyhash),
+ UINTVAL size)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(4)
+ __attribute__nonnull__(5);
+
void parrot_hash_clone_prunable(PARROT_INTERP,
ARGIN(const Hash *hash),
ARGOUT(Hash *dest),
@@ -522,6 +535,10 @@
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(compare) \
, PARROT_ASSERT_ARG(keyhash))
+#define ASSERT_ARGS_parrot_create_hash_sized __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(compare) \
+ , PARROT_ASSERT_ARG(keyhash))
#define ASSERT_ARGS_parrot_hash_clone_prunable __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(hash) \
More information about the parrot-commits
mailing list