Differences From Artifact [7139dbd166]:
- File src/OFMutableArray_adjacent.m — part of check-in [3b97fc3cd9] at 2014-01-04 00:24:08 on branch trunk — Update copyright. (user: js, size: 7377) [annotate] [blame] [check-ins using]
To Artifact [dd32892024]:
- File
src/OFMutableArray_adjacent.m
— part of check-in
[4dbca9fc06]
at
2014-04-08 17:01:53
on branch trunk
— OFArray_adjacent: Optimize fast enumeration
This restores the previous behaviour for OFArray_adjacent. It was lost
when OFArray's fast enumeration was changed to be better optimized for
huge arrays that aren't adjacent in memory. I forgot that
OFArray_adjacent just used the implementation from OFArray, as OFArray
had the ideal implementation for OFArray_adjacent, but now that OFArray
is optimized for huge, non-adjacent arrays, this wasn't the case
anymore. (user: js, size: 7594) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
296 297 298 299 300 301 302 | objects[i] = objects[j]; objects[j] = tmp; } } - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state objects: (id*)objects | | > > > | | < < > > | | | | > > | > > > > > > | | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | objects[i] = objects[j]; objects[j] = tmp; } } - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state objects: (id*)objects count: (int)count_ { size_t count = [_array count]; if (count > INT_MAX) { /* * Use the implementation from OFArray (OFMutableArray does not * have one), which is slower, but can enumerate in chunks, and * set the mutations pointer. */ int ret = [super countByEnumeratingWithState: state objects: objects count: count_]; state->mutationsPtr = &_mutations; return ret; } if (state->state >= count) return 0; state->state = count; state->itemsPtr = [_array items]; state->mutationsPtr = &_mutations; return (int)count; } - (OFEnumerator*)objectEnumerator { return [[[OFArrayEnumerator alloc] initWithArray: self mutationsPtr: &_mutations] autorelease]; |
︙ | ︙ |