only sort small dicts and sets in lib.pretty

The sorting caused performance problems when displaying large collections (e.g. #6736), even though the result would be truncated.
typing habit, not on purpose.