Although randomized controlled trials investigating the acute effect of cocoa flavanols are sparse, most of them point towards a beneficial effect on cognitive performance. Participants showed, among others, enhancements in working memory performance and improved visual information processing after having had cocoa flavanols. And for women, eating cocoa after a night of total sleep deprivation actually counteracted the cognitive impairment (i.e. less accuracy in performing tasks) that such a night brings about. Promising results for people that suffer from chronic sleep deprivation or work shifts.
Source: Cocoa and chocolate are not just treats — they are good for your cognition: Cocoa can be seen as a dietary supplement to protect human cognition and can counteract different types of cognitive decline.