Changeset 1845 in kBuild for trunk/src/kmk
- Timestamp:
- Oct 12, 2008 4:23:10 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/strcache.c
r1844 r1845 130 130 /* Hash table of strings in the cache. */ 131 131 132 #ifdef CONFIG_WITH_VALUE_LENGTH 133 static const char *lookup_string; 134 static unsigned int lookup_string_len; 135 #endif 136 132 137 static unsigned long 133 138 str_hash_1 (const void *key) … … 145 150 str_hash_cmp (const void *x, const void *y) 146 151 { 152 #ifdef CONFIG_WITH_VALUE_LENGTH 153 /* Use the string length to avoid some unncessary comparing. 154 X is either the add_hash input (during hash_find_slot) 155 or a cache entry (during rare hash_insert_at calls). 156 This catches 520253 out of 1341947 calls in the typical 157 kBuild scenario. */ 158 159 if (x == lookup_string) 160 { 161 assert (lookup_string_len == strlen ((const char *)x)); 162 if (strcache_get_len ((const char *)y) != lookup_string_len) 163 return -1; 164 } 165 #endif 147 166 return_ISTRING_COMPARE ((const char *) x, (const char *) y); 148 167 } … … 155 174 { 156 175 /* Look up the string in the hash. If it's there, return it. */ 176 #ifndef CONFIG_WITH_VALUE_LENGTH 157 177 char *const *slot = (char *const *) hash_find_slot (&strings, str); 158 178 const char *key = *slot; 179 #else /* CONFIG_WITH_VALUE_LENGTH */ 180 char *const *slot; 181 const char *key; 182 183 lookup_string = str; 184 lookup_string_len = len; 185 slot = (char *const *) hash_find_slot (&strings, str); 186 key = *slot; 187 #endif /* CONFIG_WITH_VALUE_LENGTH */ 159 188 160 189 /* Count the total number of adds we performed. */
Note:
See TracChangeset
for help on using the changeset viewer.