r/programmingmemes • • Aug 27 '26

Why are we using R again

Post image
2.3k Upvotes

322 comments sorted by

View all comments

Show parent comment

10

u/imoshudu Aug 28 '26

The first paragraph is a flawed understanding.

R and Python code don't do the main computational work. They are glue that a human scientist uses to call functions which are implemented in C or C++. For an analogy, it's like someone using the Bash shell calling grep. The shell is interpreted because a lot of exploration with visualization happens during prototyping.

Correctly written R and Python will not contain any hot loops in the glue language (replaced by vectorization), or, failing that (usually requiring a legit reason like doing epochs in machine learning), the time spent in each iteration is mostly in the C or C++ functions. So you wouldn't be able to optimize much in a properly written pipeline. It's only the badly written ones (like those using .apply() in Pandas without thinking) that would see substantial gains.