I smoke a lot of weed, but I find that smoking while coding disrupts my working memory, which makes coding difficult. Working memory = the memory you use to keep a lot of stuff in mind at once = "the stack". Having to keep referring to the code to figure out my variable names/whatever, instead of just knowing them off the top of my head, slows me down.
The funny thing is, at work we have a code word for weed - "code". We've been joking about coding for months now...