Arijit Chakraborty of the University of Auckland likened the test to identifying a single moving car at a busy intersection.
He and his co-researchers found the scores were markedly better in those whose mothers used cannabis in pregnancy than in offspring of those who didn't use it in pregnancy. The more frequently the mothers smoked and the larger the quantities, the greater the benefit.
Children of mothers who drank in pregnancy performed worse than those whose mothers did not drink, although none of the children in the study had been diagnosed with fetal alcohol syndrome. The more the mothers drank, the greater the visual impairment. Nicotine and methamphetamine had no effect and none of the four drugs affected other visual measures including visual acuity.
The researchers' paper, published yesterday in the journal Scientific Reports, says that if the cancelling-out they found with alcohol and cannabis can be repeated, this could provide a basis for future research on "new ways to prevent or ameliorate" the ill effects of prenatal drug exposure.
But Mr Chakraborty says women should await the results of scientific study on this rather than undertaking their own experiments at home.
"One improvement in one particular neurodevelopmental domain does not suggest holistically the brain is performing better. We would recommend the mothers to stop drinking in the first place instead of trying marijuana."
The researchers say that although prenatal cannabis exposure has not been studied widely, "detrimental effects have been reported for motor and cognitive development. Therefore our results cannot be extrapolated beyond global motion perception or interpreted as marijuana having beneficial effects on fetal development.
"Previous studies have reported that prenatal exposure to heavy marijuana use impairs performance on a range of ... tests of attention, memory, and executive function that involve a visual component."
The study
• 165 children's vision checked at age 4.5.
• Mother's use of alcohol, nicotine, cannabis or methamphetamine during pregnancy had been recorded.
• Cannabis use was linked to better performance on one measure of vision.
• Alcohol use was linked to worse performance on same measure.
• Used together, the two drugs cancelled each other's effects on that measure.