fn take_perm<T>(prev: Arc<T>, perm_of: impl Fn(&T) -> &SortPerm) -> SortPermwhere SortPerm: From<T>,
Reuse the previous permutation’s allocation when the cache slot held the only Arc, clone otherwise (same policy as the other derived caches).