Changeset 2834 in webkit for trunk/JavaScriptCore/kjs/identifier.cpp
- Timestamp:
- Nov 22, 2002, 3:20:01 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/identifier.cpp
r2800 r2834 22 22 #include "identifier.h" 23 23 24 #define DUMP_STATISTICS 0 25 24 26 namespace KJS { 27 28 #if DUMP_STATISTICS 29 30 static int numProbes; 31 static int numCollisions; 32 33 struct IdentifierStatisticsExitLogger { ~IdentifierStatisticsExitLogger(); }; 34 35 static IdentifierStatisticsExitLogger logger; 36 37 IdentifierStatisticsExitLogger::~IdentifierStatisticsExitLogger() 38 { 39 printf("\nKJS::Identifier statistics\n\n"); 40 printf("%d probes\n", numProbes); 41 printf("%d collisions (%.1f%%)\n", numCollisions, 100.0 * numCollisions / numProbes); 42 } 43 44 #endif 25 45 26 46 Identifier Identifier::null; … … 93 113 94 114 int i = hash & _tableSizeMask; 115 #if DUMP_STATISTICS 116 ++numProbes; 117 numCollisions += _table[i] && !equal(_table[i], c); 118 #endif 95 119 while (UString::Rep *key = _table[i]) { 96 120 if (equal(key, c)) … … 130 154 131 155 int i = hash & _tableSizeMask; 156 #if DUMP_STATISTICS 157 ++numProbes; 158 numCollisions += _table[i] && !equal(_table[i], s, length); 159 #endif 132 160 while (UString::Rep *key = _table[i]) { 133 161 if (equal(key, s, length)) … … 169 197 170 198 int i = hash & _tableSizeMask; 199 #if DUMP_STATISTICS 200 ++numProbes; 201 numCollisions += _table[i] && !equal(_table[i], r); 202 #endif 171 203 while (UString::Rep *key = _table[i]) { 172 204 if (equal(key, r)) … … 191 223 192 224 int i = hash & _tableSizeMask; 225 #if DUMP_STATISTICS 226 ++numProbes; 227 numCollisions += _table[i] != 0; 228 #endif 193 229 while (_table[i]) 194 230 i = (i + 1) & _tableSizeMask; … … 204 240 205 241 int i = hash & _tableSizeMask; 242 #if DUMP_STATISTICS 243 ++numProbes; 244 numCollisions += _table[i] && equal(_table[i], r); 245 #endif 206 246 while ((key = _table[i])) { 207 247 if (equal(key, r))
Note:
See TracChangeset
for help on using the changeset viewer.