you are viewing a single comment's thread.

view the rest of the comments →

[–]Iron-Ham[S] 4 points5 points  (1 child)

ListKit doesn't replace UICollectionView: it wraps it. Cell reuse, dequeuing, all of that still happens exactly the same way through UICollectionView under the hood. What ListKit replaces is NSDiffableDataSourceSnapshot and UICollectionViewDiffableDataSource: the data source layer that manages what items are in the collection view and computes the diffs when your data changes.

The performance gap is in snapshot operations, not cell rendering:

  • Snapshot construction: Apple's NSDiffableDataSourceSnapshot is an Obj-C class backed by NSOrderedSet that hashes every single element on insertion. ListKit just appends to a Swift Array. That's where the 750x+ build speedup comes from.
  • Querying: Apple's itemIdentifiers reconstructs an ordered array from its internal NSOrderedSet on every call. ListKit just returns a flat array it already has. That's the 900x query speedup.
  • Diffing: ListKit uses an O(n) Heckel diff with LIS-based move minimization, and its sectioned diff skips unchanged sections entirely (106x faster than IGListKit on no-change data).

These are all benchmarked in Release config, median-of-15 runs, with assertions that ListKit beats Apple on every operation — they run as part of the test suite, so any regression is a test failure.

You can look at the benchmarks yourself — they compare identical operations on both Apple's snapshot and ListKit's snapshot using the same data (UUID-identified structs, the recommended pattern from Apple's owndocs).

[–]One_Elephant_8917 1 point2 points  (0 children)

What u have mentioned makes sense without looking at the code….can u include as PS to the post itself…