For example would the following two run at different speeds if there were in a function that run millions of trials.
the.name.of.a.random.variable.in.r <- some.value
variable <- some.value
Then expanding on this how does this relate to names of functions.
My simple benchmarking experiment would indicate that it does not matter:
the.name.of.a.random.variable.in.r <- 1:1000
the.name.of.a.random.variable.in.r.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa <- 1:1000
variable <- 1:1000
microbenchmark::microbenchmark(long=sum(the.name.of.a.random.variable.in.r),
short=sum(variable),
verylong=sum(the.name.of.a.random.variable.in.r.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa))
# Unit: nanoseconds
# expr min lq mean median uq max neval cld
# long 970 987 1147.48 1036.5 1057.5 10468 100 a
# short 969 985 1038.82 1030.5 1053.5 1841 100 a
# verylong 968 988 1070.16 1036.0 1062.5 3961 100 a
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With