It is not a secret; it is described in
http://www.jsoftware.com/help/release/midot.htm
in the J5.04 release notes.

I first got the idea for m&i. in November 2003 when
Morten Kromberg and Gitte Christensen visited us
in Toronto, and mentioned a (upcoming?) feature
in Dialog APL.  

The benefits of precomputation are especially 
pronounced when the right argument is small.  
For example:

   a=:(i.1e7)+_1+2^31
   f=: a&i.
   ts=: 6!:2 , 7!:[EMAIL PROTECTED]

   x=: (2^31)+1000 [EMAIL PROTECTED] 1e7
   ts 'f x'
0.000529956 4864
   ts 'a i. x'
2.55495 1.34222e8



----- Original Message -----
From: [EMAIL PROTECTED]
Date: Thursday, June 7, 2007 2:50 pm
Subject: [Jgeneral] Roger ! what is the secret under the hood ?

> Roger,
> Why is 'f a' so much faster ?
> 
> a=:(i.1e7)+_1+2^31
>   ts'i.~a'
> 7.41238 2.01327e8
>   f=:a&i.
>   ts'f a'
> 4.6502 6.71097e7
>   5!:5<'f'
> (2147483647+i.10000000)&i.
> ts'(2147483647+i.10000000)&i.a'
> 7.79408 4.69764e8
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to