[svn:parrot] r42085 - trunk/src/gc
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Sat Oct 24 20:36:51 UTC 2009
Author: chromatic
Date: Sat Oct 24 20:36:51 2009
New Revision: 42085
URL: https://trac.parrot.org/parrot/changeset/42085
Log:
[GC] Allowed Parrot_gc_allocate_fixed_size_storage() to look up fixed-size pool
directly, which bypasses a function call elsewhere in the (likely) event
there's a pool already created. This gives fib.pir a 1.592% performance
increase.
Modified:
trunk/src/gc/api.c
Modified: trunk/src/gc/api.c
==============================================================================
--- trunk/src/gc/api.c Sat Oct 24 20:19:32 2009 (r42084)
+++ trunk/src/gc/api.c Sat Oct 24 20:36:51 2009 (r42085)
@@ -1694,8 +1694,17 @@
Parrot_gc_allocate_fixed_size_storage(PARROT_INTERP, size_t size)
{
ASSERT_ARGS(Parrot_gc_allocate_fixed_size_storage)
- PMC_Attribute_Pool * const pool = Parrot_gc_get_attribute_pool(interp,
- size);
+ PMC_Attribute_Pool *pool = NULL;
+ const size_t idx = (size < sizeof (void *)) ? 0 : (size - sizeof (void *));
+
+ /* get the pool directly, if possible, for great speed */
+ if (interp->mem_pools->num_attribs > idx)
+ pool = interp->mem_pools->attrib_pools[idx];
+
+ /* otherwise create it */
+ if (!pool)
+ pool = Parrot_gc_get_attribute_pool(interp, size);
+
return Parrot_gc_get_attributes_from_pool(interp, pool);
}
More information about the parrot-commits
mailing list