The team placed rats on a diet high in sugar and fat and compared their performance with rodents on a healthy diet. Lead researcher Margaret Morris says the rats on the poor diet developed an impaired memory after just six days.
"Poor diet was associated with a cognitive decline that happened very quickly," she found. "So within six days of the diet, the animals performed less well on a spatial memory task.
"We were surprised at how fast it was."
The scientists observed that the animals being fed a poor diet also showed inflammation in the brain's hippocampus region, the part of the brain that is involved in memory forming and storing.
"It's a little bit to early for us to say that two are causally related, but we believe that the inflammatory change is probably highly relevant for the cognitive decline," she said.
"So we need to do more work. For instance, what if we prevent that inflammation? Could that preserve the brain function? Those are the sorts of questions we want to ask."
Morris says the memory issues became apparent well before the animals showed any physical symptoms.
"The animals of course weren't obese after just six days on the diet. So the changes in cognition, the loss of memory, happened well before there was any weight change," she said.
She says it is hard to say what the implications of the trial could be for humans.
"It's hard of course to extrapolate to humans. But there is data in human volunteers fed a poor junk diet for just five days, that there was a loss of executive function," she said.
"So longer reaction times, for instance."
Manny Noakes, a senior research dietician with the CSIRO, says the study could have implications for people as they age.
"The role of diet and lifestyle and the impact that it has on memory and whether or not, in people who are getting older, where they're improving their diet based on eating what we consider to be the optimal diet, can actually, whether that can demonstrate actual improvements in memory," she said.
"I think that's a really important question that is yet to be answered."
Professor Noakes says it is an area she looks forward to seeing more research in in the future.
"I think if it is answered in the affirmative, it could lead to a really big difference with how much motivation we have to change the dietary patterns that we have," she said.
"Because losing one's memory is all about the impact that it has on us on a very, very day-to-day life and a very personal level.
"And I'm sure that having a diet that optimises one's memory is going to be something that we'll all be very, very keen to be following."
The study is published in the journal Brain, Behaviour and Immunity.