Overview
| Comment: | OFArray: Fix minor performance regression |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
51ea191cf466cdce61d4260059994a7f |
| User & Date: | js on 2020-11-06 01:23:10 |
| Other Links: | manifest | tags |
Context
|
2020-11-06
| ||
| 01:34 | OFMutableData: Resize in -[makeImmutable] (check-in: bae49c5580 user: js tags: trunk) | |
| 01:23 | OFArray: Fix minor performance regression (check-in: 51ea191cf4 user: js tags: trunk) | |
| 01:11 | OF*Data: Avoid -[allocMemoryWithSize:] (check-in: 1a70abc65d user: js tags: trunk) | |
Changes
Modified src/OFArray.m from [eac8a2ce35] to [d8de445b42].
| ︙ | ︙ | |||
237 238 239 240 241 242 243 |
for (size_t i = 0; i < range.length; i++)
buffer[i] = [self objectAtIndex: range.location + i];
}
- (id const *)objects
{
size_t count = self.count;
| < < | < < > | | > > > | | > > > > | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
for (size_t i = 0; i < range.length; i++)
buffer[i] = [self objectAtIndex: range.location + i];
}
- (id const *)objects
{
size_t count = self.count;
id *buffer = of_malloc(count, sizeof(id));
@try {
[self getObjects: buffer
inRange: of_range(0, count)];
} @catch (id e) {
free(buffer);
@throw e;
}
return [OFData dataWithItemsNoCopy: buffer
itemSize: sizeof(id)
count: count
freeWhenDone: true].items;
}
- (id)copy
{
return [self retain];
}
|
| ︙ | ︙ |