It depends on the situation and the opposition. ~15bb or less, I'm generally looking to get all in pre-flop. 15-25bbs I'm looking for spots to 3-bet shove. 25bb+, all-in is generally not the most profitable play, except in 4-bet pots.
If you are properly rolled (preferably over-rolled), then there are definitely advantages with it for setting a table image or quickly chipping up or both. If you are a poor peasant that's way out of their element with a particular buy-in, then it's probably not a good idea to risk it all on a gamble pre-flop.
It will depend on several factors, if you are in a tournament and with a fallen stack you can do it, but always with hands that are profitable in the long term, sometimes we make many mistakes of going all in every time when we are in a robbery zone, that is why you should have a winning plan taking the tables as a guide and not go all in just because.