On Wed, Dec 9, 2020 at 8:26 AM Gabor Grothendieck <ggrothendieck at
gmail.com>
wrote:
> On Wed, Dec 9, 2020 at 10:08 AM Duncan Murdoch <murdoch.duncan at
gmail.com>
> wrote:
> >
> > You might be interested in this blog post by Michael Barrowman:
> >
> > https://michaelbarrowman.co.uk/post/the-new-base-pipe/
> >
> > He does some timing comparisons, and the current R-devel
implementations
> > of |> and \() do quite well.
>
> It does bring out that the requirement of using functions to get around the
> lack of placeholders is not free but exacts a small penalty in
> terms of performance (in addition to verbosity).
>
I mean, technically, yes, but even with that overhead it's 2 *orders of
magnitude* faster than the magrittr you're used to, and by the look of it
~3x faster than the new magrittr. And, those base pipe speeds are in
microseconds. You'd have to be running that pipeline thousands of times -
which people don't generally do with pipelines in the first place - to see
a *5 millisecond* slowdown, which you would then happily fail to notice
completely because what your pipeline is actually doing takes so much
longer than those microseconds of the extra function call that its unlikely
to be detectable at all.
The bizarro pipe supports placeholders and so doesn't require
functions> as a workaround and thus would presumably be even faster. It is also
> perfectly consistent with the rest of R and requires no new syntax.
> You have to explicitly add a dot as the first argument but this seems a
> better
> compromise to me than those involved with |> .
>
I mean, I think the bizarro pipe was a pretty clever piece of work. I was
impressed by what John did there, but I don't really know what you're
suggesting here. As you say, the bizarro pipe works now without any changes
and you're welcome to use it if you prefer it to base's
(proposed/likely)
|> and magrittr's %>%.
~G
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
[[alternative HTML version deleted]]