All of the above. I've taken two loads with the same bullet, same velocity, and different powders, and gotten 4" out of one and 2" out of the other. For the barrel, twist rate is important, but you also have to consider the velocity of the bullet too. You can over or under stabilize a bullet with the wrong twist rate that doesnt match the weight and velocity of the projectile. I talked to one barrel manufacturer who recommends a different twist rate for 147gr minor pf uspsa loads compared to 147gr jhp defense loads.