Author: chromatic
Date: Fri Jun 15 21:23:47 2007
New Revision: 19033

Modified:
   trunk/lib/Parrot/Vtable.pm
   trunk/src/objects.c

Log:
[Vtable] Don't waste valuable electrons calculating something that's 
precalculated.

Modified: trunk/lib/Parrot/Vtable.pm
==============================================================================
--- trunk/lib/Parrot/Vtable.pm  (original)
+++ trunk/lib/Parrot/Vtable.pm  Fri Jun 15 21:23:47 2007
@@ -248,16 +248,19 @@
  * vtable slot names
  */
 #ifdef PARROT_IN_OBJECTS_C
+
+#define PARROT_VTABLE_LOW 9
+
 static const char * const Parrot_vtable_slot_names[] = {
-    "",     /* Pointer to namespace for this class */
-    "",     /* 'type' value for MMD */
-    "",     /* Name of class this vtable is for */
-    "",     /* Flags. Duh */
-    "",     /* space-separated list of interfaces */
-    "",     /* space-separated list of classes */
-    "",     /* class */
-    "",     /* mro */
-    "",     /* ro_variant_vtable */
+    "",   /* Pointer to namespace for this class */
+    "",   /* 'type' value for MMD */
+    "",   /* Name of class this vtable is for */
+    "",   /* Flags. Duh */
+    "",   /* space-separated list of interfaces */
+    "",   /* space-separated list of classes */
+    "",   /* class */
+    "",   /* mro */
+    "",   /* ro_variant_vtable */
 
     /* Vtable Functions */
 EOM

Modified: trunk/src/objects.c
==============================================================================
--- trunk/src/objects.c (original)
+++ trunk/src/objects.c Fri Jun 15 21:23:47 2007
@@ -39,15 +39,11 @@
 INTVAL
 Parrot_get_vtable_index(Interp *interp, const STRING *name /*NN*/)
 {
-    char * const name_c = string_to_cstring(interp, name);
-    INTVAL low    = 0;
-    INTVAL high   = NUM_VTABLE_FUNCTIONS - 1;
+    char * const name_c      = string_to_cstring(interp, name);
 
     /* some of the first "slots" don't have names. skip 'em. */
-    while (!Parrot_vtable_slot_names[low]) {
-        low++;
-        high++;
-    }
+    INTVAL low               = PARROT_VTABLE_LOW;
+    INTVAL high              = NUM_VTABLE_FUNCTIONS + PARROT_VTABLE_LOW;
 
     while (low < high) {
         const INTVAL       mid    = (low + high) / 2;

Reply via email to