One example, from long ago.
B707-320
JT4A-17 engines.
Max weight.
Max thrust...(these engines, when applicable, used a fixed derate, not flex).
Flaps 20....distance used, 11,600 feet
Flaps 30....distance used, 9,550 feet.
So, we see that the larger flap setting yields the shorter takeoff run required (obstacles permitting, of course).
Another example.
L1011-100
Weight 474,000 pounds.
Max thrust.
Flaps 10....distance for takeoff run, 12.650 feet
Flaps 18....distance for takeoff run, 10,600 feet
Flaps 22....distance for takeoff run, 9,960 feet
One more.
L1011-500, RB.211-524B402 engines
Max weight, 510,000 pounds
Airfield, JNB
Flaps 4....distance for takeoff run, 13,900 feet
Flaps 14...distance for takeoff run, 11,950 feet
Performance, 101