I have done both. It really depends on what time your flight arrives and layover time. The customs and immigration line can be vary long. About six years ago it over 2 hours, fortunately, I was overnighting in Johannesburg, tight connection I would’ve been screwed.
Last year I arrived on Qatar first flight in, business class walked right up to immigration and customs, I was through in under five minutes, Went to the SAPS office the prepaid people all got theirs done and out in five minutes. Mine took a long time as the SAPS computer was down and they had to hand write out my permit, fortunately I had a layover.