Changeset 2834 in webkit for trunk/JavaScriptCore/kjs/property_map.cpp
- Timestamp:
- Nov 22, 2002, 3:20:01 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/property_map.cpp
r2821 r2834 27 27 28 28 #define DO_CONSISTENCY_CHECK 0 29 30 // At the time I added this switch, the optimization still gave a 1.5% performance boost so I couldn't remove it. 29 #define DUMP_STATISTICS 0 31 30 #define USE_SINGLE_ENTRY 1 31 32 // At the time I added USE_SINGLE_ENTRY, the optimization still gave a 1.5% performance boost so I couldn't remove it. 32 33 33 34 #if !DO_CONSISTENCY_CHECK … … 36 37 37 38 namespace KJS { 39 40 #if DUMP_STATISTICS 41 42 static int numProbes; 43 static int numCollisions; 44 45 struct PropertyMapStatisticsExitLogger { ~PropertyMapStatisticsExitLogger(); }; 46 47 static PropertyMapStatisticsExitLogger logger; 48 49 PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger() 50 { 51 printf("\nKJS::PropertyMap statistics\n\n"); 52 printf("%d probes\n", numProbes); 53 printf("%d collisions (%.1f%%)\n", numCollisions, 100.0 * numCollisions / numProbes); 54 } 55 56 #endif 38 57 39 58 struct PropertyMapHashTable … … 116 135 117 136 int i = hash(rep); 137 #if DUMP_STATISTICS 138 ++numProbes; 139 numCollisions += _table->entries[i].key && _table->entries[i].key != rep; 140 #endif 118 141 while (UString::Rep *key = _table->entries[i].key) { 119 142 if (rep == key) { … … 140 163 141 164 int i = hash(rep); 165 #if DUMP_STATISTICS 166 ++numProbes; 167 numCollisions += _table->entries[i].key && _table->entries[i].key != rep; 168 #endif 142 169 while (UString::Rep *key = _table->entries[i].key) { 143 170 if (rep == key) … … 177 204 178 205 int i = hash(rep); 206 #if DUMP_STATISTICS 207 ++numProbes; 208 numCollisions += _table->entries[i].key && _table->entries[i].key != rep; 209 #endif 179 210 while (UString::Rep *key = _table->entries[i].key) { 180 211 if (rep == key) { … … 202 233 203 234 int i = hash(key); 235 #if DUMP_STATISTICS 236 ++numProbes; 237 numCollisions += _table->entries[i].key && _table->entries[i].key != key; 238 #endif 204 239 while (_table->entries[i].key) 205 240 i = (i + 1) & _table->sizeMask; … … 263 298 // Find the thing to remove. 264 299 int i = hash(rep); 300 #if DUMP_STATISTICS 301 ++numProbes; 302 numCollisions += _table->entries[i].key && _table->entries[i].key != rep; 303 #endif 265 304 while ((key = _table->entries[i].key)) { 266 305 if (rep == key)
Note:
See TracChangeset
for help on using the changeset viewer.