One reason languages like Python and R are slow is that they have to continually check what they’re supposed to be doing, as they’re doing it. Take the simplest possible code, something like:
a + b What does this do? Well, it depends on what a and b are. They could be numbers, as in 3 + 5 == 8, but you can’t assume that: Python can also add strings, like "foo" + "bar" == "foobar", or matrices, and you need a different algorithm for each kind of addition.