Since i. 100 100 100 30 is a large array (approximately 120 MBytes),
your benchmarks are skewed by the time required to generate
i.100 100 100 30 itself and likely the time spent in paging.  
An alternative set of benchmarks:

   x=: 2 3 4 5 6 7 8 9$'abc'
   6!:2 'shave x'
0.010415
   6!:2 's1 x'
0.00165524
   6!:2 's2 x'
0.000845918



----- Original Message -----
From: "Edushka S." <[EMAIL PROTECTED]>
Date: Friday, October 26, 2007 1:30
Subject: [Jprogramming] shave=: #@:$ 0&(|:}:) ]
To: [email protected]

> Mine:
> s2=:{~<@:((<@i.)"0@:<:@:$)
> 
> Runs slightly faster than the two mentioned above:
> shave=: #@:$ 0&(|:}:) ]
> s1=: ([EMAIL PROTECTED] $ _1:) }. ]
>    6!:2 'shave i.100 100 100 30'
> 3.63488
>    6!:2 's1 i.100 100 100 30'
> 1.14118
>    6!:2 's2 i.100 100 100 30'
> 0.795163
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to