Re: [swift-users] Optimising Set comparisons

2016-11-14 Thread Nial Giacomelli via swift-users
Many thanks to Tim for suggesting isSubset, which I had somehow missed while browsing the documentation. To answer Dave's questions: unfortunately the Set comparisons aren't an ideal candidate for asynchronous work. The comparisons take place as part of a CSS-like styling phase, whereby a number

Re: [swift-users] Optimising Set comparisons

2016-11-13 Thread David Sweeris via swift-users
> On Nov 13, 2016, at 1:58 PM, Nial Giacomelli via swift-users > wrote: > > Using Swift 3 I have a function that's called extremely frequently and is > appearing regularly in Profiler runs. The function takes two Set > instances and simply attempts to determine whether

[swift-users] Optimising Set comparisons

2016-11-13 Thread Tim Vermeulen via swift-users
guard a.isSubset(of: b) else { return false } This should be the most efficient way to do what you’re trying to do. > Using Swift 3 I have a function that's called extremely frequently and is > appearing regularly in Profiler runs. The function takes two > Setinstances and simply attempts to

[swift-users] Optimising Set comparisons

2016-11-13 Thread Nial Giacomelli via swift-users
Using Swift 3 I have a function that's called extremely frequently and is appearing regularly in Profiler runs. The function takes two Set instances and simply attempts to determine whether all items from Set A are present in Set B (it's important to note that Set B may well contain additional