reverse the evaluation order - we want to match fastest if the specified id is long (and thus unambiguous), and only generate a short id if and when we have to (as they can be duplicates)