Shorter, and much more readable, I'd say:
my Blob $blob = blob-from-carray($ed.data, size=>$ed.data_size);
say "bindata = { now - INIT now }";
The term "now" is short for "DateTime.now.Instant"
The INIT phaser is run when the program is started: it returns the value that
was obtained from the code then executed.
Phasers for the win!
> On 17 Jun 2020, at 19:01, David Santiago <[email protected]> wrote:
>
> Super!
>
> That what i was looking for, i changed the code to:
>
> my Instant $init = DateTime.now.Instant;
> my Blob $blob = blob-from-carray($ed.data, size=>$ed.data_size);
> say "bindata = {DateTime.now.Instant-$init}";
>
>
> Output:
>
> Bindata= 0.00060054
>
> So it passed from approx 1.1 to 0.0006 secs. That's quite an improvement!
>
> Thank you so much.
>
> Best regards,
> David Santiago
>
>
> Ralph Mellor <[email protected]> escreveu no dia quarta,
> 17/06/2020 à(s) 11:57:
>>
>>> Unfortunately, i get the error "Error
>>> X::AdHoc+{X::Await::Died}+{X::React::Died}: Don't know how many
>> elements a C array returned from a library"
>>
>> I googled the error message and got a bunch of matches including this:
>>
>> https://stackoverflow.com/questions/51081475/getting-data-out-of-native-pointers
>>
>> This will show the way to maximize the speed because it minimizes
>> the *number* of copy operations (to one) and expense of the copy
>> (by making it native code).
>>
>> hth