develooper Front page | perl.perl6.users | Postings from June 2020

Re: Help converting CArray[uint8] to Blob

Thread Previous | Thread Next
Ralph Mellor
June 16, 2020 23:09
Re: Help converting CArray[uint8] to Blob
Message ID:
> my Data $ed = await $yenc_promise;

The promise must initialize each element of the CArray[uint]. It looks
pretty quick; I'm guessing it's low-level code doing that.

> my uint8 @data = $[0..$ed.data_size-1].Array;
> my Blob $bindata = Blob[uint8].new(@data);

Afaict that's a total of five HLL element-by-element copies.

I would expect this to work and be at least as fast and possibly a lot faster:

my Blob $bindata .= new: $;


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About