only sort small dicts and sets in lib.pretty

The sorting caused performance problems when displaying large collections,
even when the result would be truncated.