Differences From Artifact [f28bc3a5ac]:
- File
src/OFCountedSet_hashtable.m
— part of check-in
[1255f3a11a]
at
2012-08-10 20:08:24
on branch trunk
— Directly use the runtime's autorelease pools.
This greatly improves performance, as it gets rid of the overhead of
OFAutoreleasePool. (user: js, size: 5155) [annotate] [blame] [check-ins using]
To Artifact [16ad1c4d5e]:
- File src/OFCountedSet_hashtable.m — part of check-in [c137da5e5b] at 2012-09-16 15:27:48 on branch trunk — Prefix all private methods with OF_. (user: js, size: 5152) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
166 167 168 169 170 171 172 | if (object == nil || count == nil) @throw [OFInvalidFormatException exceptionWithClass: [self class]]; number = [OFNumber numberWithSize: (size_t)[[count stringValue] decimalValue]]; | | | | | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | if (object == nil || count == nil) @throw [OFInvalidFormatException exceptionWithClass: [self class]]; number = [OFNumber numberWithSize: (size_t)[[count stringValue] decimalValue]]; [dictionary OF_setObject: number forKey: [object objectByDeserializing] copyKey: NO]; objc_autoreleasePoolPop(pool2); } objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; |
︙ | ︙ | |||
208 209 210 211 212 213 214 | OFNumber *count; count = [[dictionary objectForKey: object] numberByIncreasing]; if (count == nil) count = [OFNumber numberWithSize: 1]; | | | | | | | | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | OFNumber *count; count = [[dictionary objectForKey: object] numberByIncreasing]; if (count == nil) count = [OFNumber numberWithSize: 1]; [dictionary OF_setObject: count forKey: object copyKey: NO]; mutations++; objc_autoreleasePoolPop(pool); } - (void)removeObject: (id)object { OFNumber *count = [dictionary objectForKey: object]; void *pool; if (count == nil) return; pool = objc_autoreleasePoolPush(); count = [count numberByDecreasing]; if ([count sizeValue] > 0) [dictionary OF_setObject: count forKey: object copyKey: NO]; else [dictionary removeObjectForKey: object]; mutations++; objc_autoreleasePoolPop(pool); } - (void)makeImmutable { } @end |