"Hundreds of years of records" sounds like a big exaggeration. I don't think we can reliable talk about more than 150 years, and even that would be sparse, covering only some lucky countries. And this data is hard to evaluate as adjusting it to culture shifts, economy changes, and even to what constitutes "cruel" in different periods isn't easy.

I think, it's reasonable to suspect that demonstrative cruelty in crime punishment may have bad side-effects in the long run, but there are just a few cases in recent history where at least short-term outcomes seem to support the claim that it may reduce crime levels.