https://arxiv.org/abs/2404.10002
Abstract (emphasis mine):
The concept of a ‘Ballmer Peak’ was first proposed in 2007, postulating that there exists a very specific blood alcohol content which confers superhuman programming ability. More generally, there is a commonly held belief among software engineers that coding is easier and more productive after a few drinks. Using the industry standard for assessment of coding ability, we conducted a search for such a peak and more generally investigated the effect of different amounts of alcohol on performance. We conclusively refute the existence of a specific peak with large magnitude, but with p < 0.001 find that there was a significant positive effect to a low amount of alcohol - slightly less than two drinks - on programming ability.
Maybe it depends upon the person.
I have difficulty programming properly while listening to music so maybe I’d find it hard to do so with alcohol too.
In my case, it’s probably because I tend to keep as much of the context as possible into my current memory, which gets reduced if I’m distracted by sounds (whether music or noise). The ADHD Relief music tracks tend to work well though, since they aren’t very distracting and help get rid of other peoples’ noise.