Depends on too many factors but what you really want is to be all in heads up if it’s preflop. The more that are in the harder it is to win even if you haves AA. If you are short stacked and nobody has opened going all in is what you want to with a larger range as you need to double up before the blinds and antes eat you up.
After the river, if you have the nuts, you want everyone all in!