[Rd] What is the best way to loop over an ALTREP vector?

Serguei Sokol @oko| @end|ng |rom |n@@-tou|ou@e@|r
Tue Sep 24 09:57:46 CEST 2019


Le 24/09/2019 à 07:48, Gabriel Becker a écrit :
> Also, a small nitpick, R's internal mean function doesn't hit Dataptr, it
> hits either INTEGER_ELT (which really should probably be a
> ITERATE_BY_REGION) or ITERATE_BY_REGION.
>
Even if it is not the main point of this thread, I was wondering if 
mean() could take an advantage of sum() (which handles ALTREP in 
efficient way) to be defined as mean(x)=sum(x)/length(x)? Currently, 
sum(1:1e14) is almost instantaneous while mean(1:1e14) is very long.

Best Serguei.



More information about the R-devel mailing list