Re: [swift-corelibs-dev] IndexPath performance

2016-08-02 Thread Kevin Ballard via swift-corelibs-dev
FWIW, if you agree that this approach is reasonable, I would be willing to write the patch for it. -Kevin Ballard On Tue, Aug 2, 2016, at 05:46 PM, Kevin Ballard wrote: > I agree with Stephan, NSIndexPath performance is important and we > should avoid the overhead of allocating/freeing an array f

Re: [swift-corelibs-dev] IndexPath performance

2016-08-02 Thread Kevin Ballard via swift-corelibs-dev
I agree with Stephan, NSIndexPath performance is important and we should avoid the overhead of allocating/freeing an array for the common case. Instead of just always wrapping NSIndexPath, maybe we should just switch the internal representation to something like enum Indices { case one(Int)

Re: [swift-corelibs-dev] IndexPath performance

2016-08-02 Thread Stephan Tolksdorf via swift-corelibs-dev
Tony, I understand why you'd ideally want to have a real-world benchmark to guide performance optimisations, but if you require that for every performance-related change, you set a very high bar, and that bar will probably have the effect of biasing performance downwards, since if there is no exis

Re: [swift-corelibs-dev] IndexPath performance

2016-08-02 Thread Tony Parker via swift-corelibs-dev
Hi Stephan, > On Aug 2, 2016, at 6:04 PM, Stephan Tolksdorf wrote: > > Hi Parker, > > I noticed the IndexPath overhead when I investigated why a Swift 3 > implementation of UICollectionViewLayout.layoutAttributesForElementsInRect > spent more time in malloc, free and related methods, but I do

Re: [swift-corelibs-dev] IndexPath performance

2016-08-02 Thread Stephan Tolksdorf via swift-corelibs-dev
Oh, I'm sorry, Tony, I was too hasty and mistook your last name for your first name :-( - Stephan On 2 August 2016 at 12:04, Stephan Tolksdorf wrote: > Hi Parker, > > I noticed the IndexPath overhead when I investigated why a Swift 3 > implementation of UICollectionViewLayout.layoutAttributesFo

Re: [swift-corelibs-dev] IndexPath performance

2016-08-02 Thread Stephan Tolksdorf via swift-corelibs-dev
Hi Parker, I noticed the IndexPath overhead when I investigated why a Swift 3 implementation of UICollectionViewLayout.layoutAttributesForElementsInRect spent more time in malloc, free and related methods, but I don't have a benchmark. Is it important that IndexPath uses native Swift refcounting?

Re: [swift-corelibs-dev] IndexPath performance

2016-08-02 Thread Tony Parker via swift-corelibs-dev
Hi Stephan, Do you have some benchmarks that you could share? That would help us focus performance work in the right area. I know that 2-item IndexPaths are super common with UIKit collection view and friends, so we may just want to special case those. Unfortunately, NSIndexPath is not abstrac

[swift-corelibs-dev] IndexPath performance

2016-08-01 Thread Stephan Tolksdorf via swift-corelibs-dev
Hi, IndexPath is currently implemented using an [Int] array that is bridged to an NSIndexPath only on demand. Since IndexPath values are primarily used together with Objective-C APIs, wouldn't it be better to implement IndexPath directly as an NSIndexPath wrapper, in order to avoid the overhead of