mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-24 01:38:26 +00:00
Move the DEBUG uniqueness check outside of for-loop inside IGListAdapter
Summary: The original DEBUG was put inside a for loop, which caused a quadratic looping while creating bigger and bigger NSSet. This is very inefficient and I verified that by profiling with 10000 objects in the array and it caused significant amount of CPU. The main thread is pretty much unresponsive. Closes https://github.com/Instagram/IGListKit/pull/1084 Reviewed By: rnystrom Differential Revision: D6903043 Pulled By: lorixx fbshipit-source-id: 311e8a402eb8d5574fce0eabd626a674b6a5e8c5
This commit is contained in:
parent
37c798ac78
commit
c617b18eb6
1 changed files with 5 additions and 5 deletions
|
|
@ -621,13 +621,13 @@
|
|||
}
|
||||
|
||||
[sectionControllers addObject:sectionController];
|
||||
|
||||
#if DEBUG
|
||||
IGAssert([NSSet setWithArray:sectionControllers].count == sectionControllers.count,
|
||||
@"Section controllers array is not filled with unique objects; section controllers are being reused");
|
||||
#endif
|
||||
[validObjects addObject:object];
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
IGAssert([NSSet setWithArray:sectionControllers].count == sectionControllers.count,
|
||||
@"Section controllers array is not filled with unique objects; section controllers are being reused");
|
||||
#endif
|
||||
|
||||
// clear the view controller and collection context
|
||||
IGListSectionControllerPopThread();
|
||||
|
|
|
|||
Loading…
Reference in a new issue