Skip to content

NSSet -> Set, add Hashable#2659

Merged
calda merged 1 commit intoairbnb:masterfrom
ladd:lvt-remove-nsset
Mar 9, 2026
Merged

NSSet -> Set, add Hashable#2659
calda merged 1 commit intoairbnb:masterfrom
ladd:lvt-remove-nsset

Conversation

@ladd
Copy link
Contributor

@ladd ladd commented Mar 5, 2026

  • As a small optimization, use Set instead of NSSet for itemsInValidRenderGroups.
  • Use ObjectIdentifier to support this.


let itemsInValidRenderGroups = NSSet(
array: renderGroups.lazy
let itemsInValidRenderGroups = Set(
Copy link
Member

@calda calda Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now this hashes by class identity instead of by value identity, right?

How about we change this to Set<ObjectIdentifier> instead by doing .map { ObjectIdentifier($0) } and then changing the check below to: !itemsInValidRenderGroups.contains(ObjectIdentifier(item.item)).

This would avoid changing the runtime semantics, and would avoid the need to add a custom Hashable conformance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I had a similar thought after playing around with it more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL. I could add a ShapeLayer test, but it looks like this is covered by existing tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np about tests, I trust this will be covered by the snapshot tests

@ladd ladd force-pushed the lvt-remove-nsset branch from 3baf343 to 72847b5 Compare March 9, 2026 17:09
@ladd ladd marked this pull request as ready for review March 9, 2026 17:10
Copy link
Member

@calda calda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@calda
Copy link
Member

calda commented Mar 9, 2026

I'll figure out what broke out GH actions CI, probably an actions runner change

@calda
Copy link
Member

calda commented Mar 9, 2026

It was just a flake, great

@calda calda merged commit 3a7fb59 into airbnb:master Mar 9, 2026
31 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants