Well, we don't know how well Doyle was familiar with drugs and their effects. Also, we know that not only did Holmes use morphine or cocaine, but if I recall correctly he would also use a combination. And when Holmes takes the drugs in The Sign of the Four, he says it's because he needs his brain to be occupied and can't have nothing to do, so the drug is a substitute for when he has no work. If cocaine makes you alert, that seems like it would occupy his mind, then, make it race like when he's working.