On Saturday, July 3rd, 2021 at 6:50 PM, Julian Fondren 
<[email protected]> wrote:
> That takes about 80x as long as the attached method
> using the FFI and a quick library in D.

That attachment got stripped? Well, it's nothing special.

extern(C) void triples(int* xs, int len) @nogc {
    foreach (i; 0 .. len)
        xs[i] = triple(xs[i]);
}

   triplesd =: './libtriple.so triples n *i i'&cd
   triples =: [: triplesd (; #)
   triples 123334 122344 121212 111222 112122 555432
+-+-----------+-+
|0|1 0 0 1 0 1|6|
+-+-----------+-+
   $(#~ triple"1) sn
33219 6
   $(#~ 1 {:: triples) n
33219
   30 timex '$(#~ triple"1) sn'
0.869076
   30 timex '$(#~ 1 {:: triples) n'
0.0100672

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to