First posts here so be gentle on a learning shooter

I see there is a big difference in the barrel lengths offered in the same calibre. Like .308 comes in anything from a 16" barrel scrub rifle to 30" barrel target rifle.
I know there are different loads but nearly double the barrel length seems like a huge difference?
I suppose I would have thought there would be quite common length somewhere in the middle and a few on the outsides for specific purposes.
Or does the barrel length just not matter so much?