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

Re: Help converting CArray[uint8] to Blob

Thread Previous | Thread Next
From:
David Santiago
Date:
June 16, 2020 22:17
Subject:
Re: Help converting CArray[uint8] to Blob
Message ID:
CAO5X0j40zdpaeE2cDvMHtO=kNgjYFPoBaGTHG1u3H23pr0+-Aw@mail.gmail.com
Thanks for the answer.

There's a slight performance improvement, but It still takes more than 1 second:

Code:

my Instant $init3 = DateTime.now().Instant;
#my Blob $bindata = Blob[uint8].new(@data);
my Blob $bindata = Blob[uint8].new($ed.data[^$ed.data_size]);
say "Bindata in {DateTime.now.Instant - $init3}";


Bindata in 1.1250962


:-(

Curt Tilmes <curt@tilmes.org> escreveu no dia terça, 16/06/2020 à(s) 21:40:
>
> On Tue, Jun 16, 2020 at 5:18 PM David Santiago <demanuel@gmail.com> wrote:
> > my uint8 @data = $ed.data[0..$ed.data_size-1].Array;
> > my Blob $bindata = Blob[uint8].new(@data);
>
> Not absolutely sure, but it seems like you are copying the data twice.
> Try just
>
> my $bindata = Blob.new($ed.data[^$ed.data_size]);

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About