list1=: (i. 10e6)

   list2=: (1e6 + i. 9e6)

   10 (6!:2) 'list2 e. list1'

0.0412252

   10 (6!:2) '(1e6 + i. 9e6) e. (i. 10e6)'

0.20568


i5-4300U @ 1.90/2.5 GHz

Taking the list creation out of the timing makes a significant difference.


On Wed, Dec 7, 2016 at 9:51 AM, Henry Rich <[email protected]> wrote:

>    6!:2 '(i. 10000000) i. (1000000 + i. 9000000)'
> 0.121106
>
> this is i3-3120M at 2.5 GHz (2012, Ivy Bridge architecture).
>
> Henry Rich
>
>
> On 12/6/2016 3:44 PM, 'Pascal Jasmin' via Programming wrote:
>
>> the in function in q is e. in J.
>>
>>
>>
>>
>> ----- Original Message -----
>> From: Björn Helgason <[email protected]>
>> To: Programming forum <[email protected]>
>> Sent: Tuesday, December 6, 2016 3:41 PM
>> Subject: Re: [Jprogramming] in function which beats the benchmark
>>
>> in =. [: I. E.
>>
>>         1 3 in 4 2 1 3 4 6 1  3
>> 2 6
>>
>>
>>
>> On 6 Dec 2016 09:46, "Abi" <[email protected]> wrote:
>>
>> Hi,
>> I am new to J. Can someone implement the *in* function.
>> I have tried various ways but cannot get to beat the benchmark of ~130 ms.
>>
>> list1: 0 til 10MM
>> list2 : 1M till 10MM
>>
>> list2 *in* list1
>>
>> The line above shows the in operator.
>>
>> Thanks.
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to