Researchers say they're surprised by the size and speed of the mood improvement among uni students who added more healthy foods to their diets, saying that similar results in a drug trial would have them "jumping for joy".

The study, published in a peer-reviewed journal this week, strengthens the known link between diet and depression, and suggests that relying on mi goreng and meat pies to get through exams is not a great idea.

The Macquarie University researchers followed 76 Australian adults aged between 17 and 35 with moderate-to-severe depression symptoms and a diet of cakes, soft drinks, and highly processed foods like burgers and pizzas.

Half of the participants were told to stick with their regular diet, and the other half were encouraged to eat more healthily - more fruit and vegetables, fish, whole grains, legumes (e.g. beans), nuts, seeds, olive oil and avocados.

Three weeks later, researchers checked back in. According to Dr Heather Francis, a clinical neuropsychologist and lead author of the study, the first surprise was the participants had actually stuck to the healthy diets.

"We wondered whether they were even going to have the time or money to be able to undertake these diet changes" she told Hack.

"They also had elevated depression symptoms, and one of the depression symptoms is reduced motivation."

But the doubts were unfounded. Not only had the the healthy-eating group mostly stuck to the fruit and veg, but they'd also showed "significant improvement" in mood, while the other group's depression scores remained unchanged.

What counts as "significant"? To put it into perspective, seeing this kind of mood improvement in just three weeks would be an amazing result for a clinical drug trial, according to Dr Francis.

"We would be jumping up and down with joy," she said.

We thought we might get an improvement but I don't know if we expected it to be that large. We were pleasantly surprised.

That doesn't mean replacing drugs and therapy with a can of cannellini beans, but it shows diet is a good first step for treating depression.

Researchers also found the mood-boosting effects appear to last for as long as the diet. After three months, participants who had maintained the healthy diet had lower depression scores than those who had reverted back.

How can what goes in your stomach affect mental health?

It may seem a little counter-intuitive that eating arguably less yummy foods can actually improve your mood, but Dr Francis has a theory.

It's all to do with inflammation, she thinks. Inflammation is the body's natural response to injury and infection. For example, when you sprain an ankle, the joint swells up and becomes hot, or when you get a cold you can grow hot and foggy-headed — that's not the virus itself, but the body's inflammatory response.

"But in today's environment, we have a lot of factors that mean that instead of the inflammation being a brief reaction to fight infections, it's going on over a longer term," Dr Francis said.

"When it's chronic like that, that foggy-headedness, that low mood, all of those things, that's when it becomes problematic."

In other words, depression is associated with chronic inflammation, and diet is a factor in increasing or reducing inflammation.

"And there's probably also a relationship between the gut microbiome and inflammation, but it's a complex one that remains to be explored," Dr Francis added.

This isn't the first time that a study has shown people who tend to eat a poor diet have an increased risk of depression, but it's the first to look at young adults — a demographic that has higher rates of depression and generally poor diets.

Previous studies have shown that one week of a poor diet can affect the memory performance of otherwise healthy young adults.

"When you're younger, you can eat a lot of rubbish and it doesn't manifest as weight gain" Dr Francis said.

"it's almost like that immediate factor that can deter you from eating poorly isn't there and suddenly as you get a bit older, in your 30s or 40s, and your metabolism slows down you think, 'Oh, I need to start dating a bit healthier'.

"But actually these effects on the brain are occurring when you're in your 20s.

"What you're eating and putting into your body now, even if you're not gaining weight because of it, it can be affecting your brain."