From @oko| @end|ng |rom |n@@-tou|ou@e@|r  Tue Sep 24 09:57:46 2019
From: @oko| @end|ng |rom |n@@-tou|ou@e@|r (Serguei Sokol)
Date: Tue, 24 Sep 2019 09:57:46 +0200
Subject: [Rd] What is the best way to loop over an ALTREP vector?
In-Reply-To: <CAD4oTHFEHj+zFd=2qD1mO+88ZFPwLMSuVfcZnPn06zxNoHNenA@mail.gmail.com>
References: <CAGiFhPN+ncuPMY9UbEO+b0wis0EJ0R9AaWSB0By-CD3fNetO1A@mail.gmail.com>
 <CAD4oTHFhAoeRCu5g15DkLpdRr=PF9hLBHufOrh3CvF8E04qz=A@mail.gmail.com>
 <CAGiFhPMy92bcvkvvjoQ64jZnQK+Erc==qmG8tiy70ri6qYOu_w@mail.gmail.com>
 <CAGiFhPMLhXJKyvRiHsf-L-NBdDc0f-UoWadXvJzCiaMX-GTdvQ@mail.gmail.com>
 <CAGiFhPP9JhYkM2KryadOOKt2h0bEDQj+RJvD2UScNZyejcNSCw@mail.gmail.com>
 <C6BDF92E-31A5-46DA-963D-1D7C73720F95@rud.is>
 <CAD4oTHFEHj+zFd=2qD1mO+88ZFPwLMSuVfcZnPn06zxNoHNenA@mail.gmail.com>
Message-ID: <44b4a9f7-c99a-d2ef-792d-b492e52fb9b5@insa-toulouse.fr>

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.



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