Has anyone ever looked into switching from source filters to something
built on  Devel::Declare (or similar) for NiceSlice? I'm not sure about the
performance impacts, but it might help compile time. In addition, there
seems to be a consensus within the Perl community that that is the most
robust, modern method of extending the language.

I don't know enough about the internals of PDL or Devel::Declare to suggest
anything; just a question.
 On May 22, 2013 10:17 AM, "Chris Marshall" <[email protected]> wrote:

> There are two issues with PDL::NiceSlice performance:
>
>  (1) compile time with the source filter
>  (2) execution time (it calls nslice() under the hood)
>
> Part of the PDL::NiceSlice work in progress and planned
> to be completed for PDL3 is the ability to pre-compile
> source files which avoids compile time delays which
> can be significant for large source files.
>
> The second part is the rework of nslice() to not call
> slice() to do its work.  In fact, it seems more reasonable
> to have slice() call nslice().
>
> --Chris
>
>
> On Wed, May 22, 2013 at 4:19 AM, Kaj Wiik <[email protected]> wrote:
> > First, I was forced to use Matlab for a while (I used it before moving
> > perl and PDL). I had forgotten how cubersome it is to express
> > algorithms compared to PDL. Cheers to all PDL developers!!
> >
> > While ago (indeed with using Devel::NYTProf) I noticed that ->slice()
> > is much faster than NiceSlice and nslice:
> >
> > use PDL;
> > use PDL::NiceSlice;
> > use Benchmark qw(:all);
> >
> > $count = 100000;
> > $a = zeroes(100);
> > $results = timethese($count,
> >              {
> >              'slice' => sub { my $b = $a->slice("5:50"); },
> >              'NiceSlice' => sub { my $b = $a(5:50); },
> >              'nslice' => sub { my $b = $a->nslice([5,50]); },
> >              },
> >              'none'
> >     );
> > cmpthese( $results ) ;
> >
> >
> >               Rate NiceSlice    nslice     slice
> > NiceSlice  48544/s        --      -11%      -75%
> > nslice     54348/s       12%        --      -72%
> > slice     192308/s      296%      254%        --
> >
> > Also (a trivial thing) growing a piddle is very expensive,
> > preallocating is much faster, but that is trivial. Perhaps worth of
> > emphasizing in documentation.
> >
> > Cheers,
> > Kaj
>
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to