Differences From Artifact [cfc47921d9]:
- File src/OFMutableSet.m — part of check-in [8892ae9fcc] at 2012-07-12 01:28:46 on branch trunk — Don't access isa directly. (user: js, size: 3995) [annotate] [blame] [check-ins using]
To Artifact [3f9a210be5]:
- File
src/OFMutableSet.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: 3978) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
16 17 18 19 20 21 22 | #include "config.h" #include <assert.h> #import "OFMutableSet.h" #import "OFMutableSet_hashtable.h" | < > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #include "config.h" #include <assert.h> #import "OFMutableSet.h" #import "OFMutableSet_hashtable.h" #import "OFNotImplementedException.h" #import "autorelease.h" static struct { Class isa; } placeholder; @interface OFMutableSet_placeholder: OFMutableSet @end |
︙ | ︙ | |||
140 141 142 143 144 145 146 | { @throw [OFNotImplementedException exceptionWithClass: [self class] selector: _cmd]; } - (void)minusSet: (OFSet*)set { | | | | | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | { @throw [OFNotImplementedException exceptionWithClass: [self class] selector: _cmd]; } - (void)minusSet: (OFSet*)set { void *pool = objc_autoreleasePoolPush(); OFEnumerator *enumerator = [set objectEnumerator]; id object; while ((object = [enumerator nextObject]) != nil) [self removeObject: object]; objc_autoreleasePoolPop(pool); } - (void)intersectSet: (OFSet*)set { void *pool = objc_autoreleasePoolPush(); size_t count = [self count]; id *cArray; cArray = [self allocMemoryWithSize: sizeof(id) count: count]; @try { |
︙ | ︙ | |||
176 177 178 179 180 181 182 | for (i = 0; i < count; i++) if (![set containsObject: cArray[i]]) [self removeObject: cArray[i]]; } @finally { [self freeMemory: cArray]; } | | | | | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | for (i = 0; i < count; i++) if (![set containsObject: cArray[i]]) [self removeObject: cArray[i]]; } @finally { [self freeMemory: cArray]; } objc_autoreleasePoolPop(pool); } - (void)unionSet: (OFSet*)set { void *pool = objc_autoreleasePoolPush(); OFEnumerator *enumerator = [set objectEnumerator]; id object; while ((object = [enumerator nextObject]) != nil) [self addObject: object]; objc_autoreleasePoolPop(pool); } - (void)makeImmutable { } @end |