I'm not really sure, for me personally at least. I don't doubt that it helps and has a considerable effect for others, but for me, I just don't really notice any considerable difference, or any good difference at least.
If I just pig out and eat half an XL pizza with half a 2 liter of mountain dew, sure I can probably say I notice a difference with my mental function itself afterwards, and not just a negative feeling from knowingly doing something unhealthy.
But I've been trying to identify any considerable positive differences in my mental function itself when I make an effort to eat healthy and in moderation, and I just can't seem to. This has become a fairly prominent concern for me too due to my relatively recent problem of eating unhealthy food, or just a considerable amount of food in general because of the stimulation aspect, and that it's one of very few things I genuinely enjoy and makes me happy, at least while I'm doing it.