pub enum Ordering {
PackLexicographicalThenLooseLexicographical,
PackAscendingOffsetThenLooseLexicographical,
}
Expand description
Define the order in which objects are returned.
Variants§
PackLexicographicalThenLooseLexicographical
Traverse packs first as sorted by their index files in lexicographical order (sorted by object id), then traverse loose objects as sorted by their names as well.
This mode uses no memory as it’s the natural ordering of objects, and is best to obtain all object ids as quickly as possible, while noting that these may contain duplicates. However, it’s very costly to obtain object information or decode them with this scheme as cache-hits are unlikely with it and memory maps are less efficient when loading them in random order.
PackAscendingOffsetThenLooseLexicographical
Traverse packs first yielding object ids sorted by their position in the pack, with those at the beginning of the pack file coming first. Then follow loose objects sorted by their names.
This mode allocates and as to pre-sort objects by their offsets, delaying the start of the iteration once per pack while keeping memory allocated once per pack. This price is usually worth paying once querying object information is planned as pack caches are more efficiently used that way.