You might try pdl(@l) instead of cat(@l) -- for a while, the newer constructor was marginally faster than cat().

You might want to check the dimincs fields in the PDL you get back from transpose -- I could be wrong, but I think it just manipulates the dimincs rather than carrying out the actual transposition in memory (which is why it is so fast).

If you're going for raw speed, your best bet is to use an Inline::C block to dive into the Perl internals, rather than futzing about at the PDL level -- I don't think you're going to get around having to do that transposition if you stay in the interpreter.



On Jun 22, 2011, at 10:15 PM, Dima Kogan wrote:

Hi.

I'm working on improving the efficiency of some PDL code I'm working
on. Can anybody think of a way to make the following more efficient?

Suppose that @l is a list of equally-dimensioned 1D piddles. I want to

 print ${ cat(@l)->transpose->get_dataref };

I.e. I want to print the binary representation of the data in the
piddles, in an interleaved way. The piddles in @l could be vaffine, and
I'd prefer to not make them physical (as get_dataref does). Using PP
makes them physical as well. The piddles in @l could also have
different types, and I'd like to use the original type if possible,
without converting (cat() does convert above). I tried several things,
but none can beat the simple snippet above in performance. Any ideas?

Thanks
dima

_______________________________________________
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