Python and R do not generate high performing code. At best they generate calls to high performing code.
It should be noted that this is usually sufficient. But particularly for earth scale problems it can often not be.
If so, it looks like you're interfacing from R to high-performing code written in C. Isn't that exactly what OP was describing?
Now, I generally use Julia for heavy computes, and usually its much faster than R. But not always.
And this little bit of code runs for hours on the largest instance on AWS every day. Why I was looking so speed it up.
Like, R is “what if we made a lisp inspired version of Python built around numpy and pandas and then reversed timed”
And data.tables in R is faster (and I think nicer to write) than DataFrames in Julia. And since data.tables feed my optimization, R still wins.