In it's actual state getMinIndex negates the input and calls the function getMaxIndex which is implemented in C and supposedly fast.
The negation decreases speed of getMinIndex slightly as the following benchmark shows:
library(microbenchmark)
library(ggplot2)
library(BBmisc)
x = rnorm(10000)
res = microbenchmark(getMinIndex(x), getMaxIndex(x), times = 1000, control = list(warmup = 1000))
autoplot(res)
In it's actual state
getMinIndex
negates the input and calls the functiongetMaxIndex
which is implemented in C and supposedly fast. The negation decreases speed ofgetMinIndex
slightly as the following benchmark shows: