Is NSS faster than NSArray?

I am new to iOS. Does anyone know if NSSetfaster than NSArray? Why don't I just use it NSArray?

Can someone explain the difference between NSSetand NSArray?

+1
source share
3 answers

NSSet is used to create unique objects.

NSArray may have duplicate objects.

NSSet is an unordered collection.

NSArray is an ordered collection.

enter image description here

NSArray is faster than NSSet for easy hold and iteration. Less than 50% faster to build and 500% faster to iterate. if you only need to rename the contents, do not use NSSet.

+16
source

, , . , , , .

0

All Articles