PR 2982 optimized ConversationViewController.createGroupMembershipCollisionBannerIfNecessary` that fetches user profiles off the main thread and then, when that completes, uses them on the main thread to find duplicate display names. The optimization doesn't work for large groups. Because `UserProfileReadCache` is backed by an LRUCache with a maximum capacity of 32, there is effectively no cache and profiles get fetched twice. The main purpose of this commit is to fix this optimization for large groups without expanding memory usage unnecessarily. While increasing the LRU cache's size to 1000 (or some other arbitrary value) would fix the problem very simply, my gut tells me that we're going to keep running into this problem. Rather than pick an arbitrary "large enough" value, this commit increases the cache size to be just large enough for its intended purpose and to keep it that size for just long enough to do its job. This commit introduces the concept of a "lease" on a larger cache size. The cache's size is defined as the largest of all its leases plus its "regular" size (the size it was initialized with). For now only the user profile cache uses it. |
||
|---|---|---|
| .. | ||
| ContactsManagerCache.swift | ||
| IncomingContactSyncJobQueue.swift | ||
| NewAccountDiscovery.swift | ||
| OWSContactsManager.h | ||
| OWSContactsManager.m | ||
| OWSContactsManager.swift | ||
| OWSGroupSyncProcessingJobQueue.swift | ||
| OWSSyncManager.h | ||
| OWSSyncManager.m | ||
| OWSSyncManager.swift | ||
| SystemContactsFetcher.swift | ||