I have seen a recommendation, that there should be no more security scopes than 5000:
For most farms, we recommend that you consider lowering this limit to 5,000 unique scopes. For large lists, consider using a design that uses as few unique permissions as possible. When the number of unique security scopes for a list exceeds the value of the list view threshold (set by default at 5,000 list items), additional SQL Server round trips take place when the list is viewed, which can adversely affect list view performance. A scope is the security boundary for a securable object and any of its children that do not have a separate security boundary defined. A scope contains an Access Control List (ACL), but unlike NTFS ACLs, a scope can include security principals that are specific to SharePoint Server 2013. The members of an ACL for a scope can include Windows users, user accounts other than Windows users (such as forms-based accounts), Active Directory groups, or SharePoint groups.
The question is: how do we determine the number of unique security scopes inside document library? (maybe someone has a PS script for that?)
Example1 If we have one document with these broken permissions:
SPAdmins - contribute;
user1 - contribute, read;
SPReaders - read
How many unique security scopes do we have? 3 ? 4 ? other?
Example2 If we have one document with broken permissions(same as example1) inside folder with inherited permissions:
SPEditors - contribute;
user5 - contribute, read;
SPViewers - read
How many unique security scopes do we have overall? 3? 4? 6? 8? other?
Example3 We have one document with inherited permissions inside folder with inherited permissions:
SPAdmins - contribute;
user1 - contribute, read;
SPReaders - read
How many unique security scopes do we have overall? 3? 4? 6? 8? other?
Example4 we have one document with broken permissions:
SPAdmins - contribute;
and another document with broken permissions in the same folder:
SPAdmins - contribute;
How many unique security scopes do we have overall? 2? 1? other?