I personally believe that a punishment especially death penalty, is not sufficient to prevent a person in committing a crime.
In Rational Choice Theory, it says that an offense is done when in the deliberation of the possible offender, his personal benefit outweighs the punishment. A person has free will, he has choices and can decide what is good for him. Yes, death penalty can possibly stop a person from committing a crime, but to a certain extent only.
May be, death penalty can hinder some crimes, but those crimes with superficial motives only. I mean those crimes whose intent is not that significant to risk a severe punishment like death penalty. But when the motive is considerable, then benefit will outweigh the cost. We can do nothing about a person too motivated to commit the crime. Crimes like robbery for example, when the punishment for this is death penalty then it is probable that there will be a significant drop of robbery cases.
This is because in this situation, the cost outweighs the benefit. Who would dare his life just for the money? This leaves the offender deciding not to commit the offense. But when we are talking about severe hatred and loathing, this may be an enough drive for a person to make him decide on risking the cost to commit the crime. Committing a crime when you know what risks it entails is like buying an expensive thing. A severe crime is equal to a severe punishment. Say, when the offender is ready to buy such crime, then no matter how big the punishment is, there is really nothing we can do.