Integer <[EMAIL PROTECTED] has already been made faster and leaner
in J6.02x as previously discussed in the forum.
The improvement is the greatest when the divisor
is a power of 2.

   y=: 1e6 [EMAIL PROTECTED] 1000
   ts=: 6!:2 , 7!:[EMAIL PROTECTED]

   NB. J6.02x
   ts '<.y%3'
0.215045 2.09721e7
   ts 'y <[EMAIL PROTECTED]'
0.023161 4.19501e6
   ts 'y <[EMAIL PROTECTED] 256'
0.0102885 4.19507e6
   
   NB. J6.01
   ts '<.y%3'
0.215612 2.09721e7
   ts 'y <[EMAIL PROTECTED] 3'
0.216431 2.09722e7
   ts 'y <[EMAIL PROTECTED] 256'
0.219403 2.09723e7



----- Original Message -----
From: Oleg Kobchenko <[EMAIL PROTECTED]>
Date: Monday, February 12, 2007 6:36 pm
Subject: Re: [Jgeneral] large space overhead

> How about this
> 
> >    y=: 1e6 [EMAIL PROTECTED] 1000
> 
>   s=: y%3
>   ts '<.s'
> 0.190772 1.25836e7
>   ts '<.y%3'
> 0.209075 2.09721e7
>   ts 'y<[EMAIL PROTECTED]'
> 0.209349 2.09722e7
> 
>   ts 'y<[EMAIL PROTECTED]"0]3'
> 0.846868 4.19571e6
>   ts '0.3<[EMAIL PROTECTED]"0 y'
> 0.84268 4.1959e6
> 
>   0.846868 4.19571e6 % 0.190772 1.25836e7
> 4.43916 0.333427
>   0.846868 4.19571e6 %~ 0.190772 1.25836e7
> 0.225268 2.99916
> 
> I.e. if integerization is done memberwise,
> the space savings is three times.
> But at the expense of speed, which should be
> compensated by special code.
> 
> 
> --- Roger Hui <[EMAIL PROTECTED]> wrote:
> 
> > A quick benchmark:
> > 
> >    x=: 1e6 [EMAIL PROTECTED] 0
> >    y=: 1e6 [EMAIL PROTECTED] 1000
> >    t=: x*y
> > 
> >    ts=: 6!:2 , 7!:[EMAIL PROTECTED]
> >    ts '<.t'
> > 0.201745 1.25836e7
> >    ts '<.x*y'
> > 0.242125 2.09721e7
> > 
> >    0.242125 2.09721e7 % 0.201745 1.25836e7
> > 1.20015 1.66662
> > 
> > Factor of 1.2 in time and 1.7 in space.  Not worth it.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to