masturbation doesn't necessarily hinder gains, but not masturbating may speed them.
the logic is this: after ejaculation, bloodflow to the penis is reduced. if you don't masturbate, you stay plump longer. more bloodflow = better gains.
try not to get off for like 3-4 hours after a workout. getting off before a workout may make it more difficult to maintain the erection level needed for certain exercises. however, some guys (especially beginners) have trouble keeping their erection low enough to do many exercises, in which case ejaculation before hand may be beneficial.
with blood pressure based exercises - jelqs, uli's, pumping, etc. ejaculation before hand would probably not be recommended as bloodflow is essential to the effectiveness of the exercise. with exercises that target stretching of the ligaments or deformation of the tunica - stretches, bundled stretches, hanging, etc. the decreased bloodflow caused by ejaculation may actually be an advantage as the blood will not restrict the stretching of the tissue.
learn your penis and its indicators, find what works for you. good luck!