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.
I don't know about coding & smoking weed, but coding on an LSD trip is very hard. With a huge effort you can barely manage to do it. I tried it as an experiment, but I'll never do it again. It takes out the fun from both coding & LSD.