Another throwaway here.
As a random anecdotes, I was an opiate addict (Heroin mainly) for the last six years, while working as an engineer. Not in the Bay area mind you. As weird as it sounds, opiates help(ed) me focus. I was a very functional addict.
Nowadays I'm clean (have been for the past 9 months), well sort of. I'm on suboxone. It still helps me focus, helps with my severe depression, and is legal and literally 50 times cheaper per day.
I have weird brain chemistry however; opiates don't perk most people up. It makes me laser sharp. However, Heroin has so many other negative effects, it's not worth it financially and legally.
I don't suggest others follow my path, it's too dangerous and a consequence of my idiot 16yo self. But I'm doing great nowadays. Just wanted to add my odd anecdote to the pile.