Earlier I made a rash statement that I thought that using ;, for selecting
a substring as apposed to b{.a}. and (a+i.b){ . Later I thought I should
test it. First I searched the Release Notes and found nothing. If there is
any optimization it was done a long time ago. So I tested it. I used a
large string, which is not the typical, but for large strings it looks like
;. is faster by maybe a factor of 10.

   s=:1e6$'abcdefghjklmnopqrstuvwxyz'
   6!:2 '10000 50000 (]];.0~[:,:[) s'
3.65898e_5
   6!:2 '50000{.10000}.s'
0.000340909
   6!:2 '(10000+i.50000){s'
0.000331539
   7!:2 '10000 50000 (]];.0~[:,:[) s'
69120
   7!:2 '50000{.10000}.s'
1116032
   7!:2 '(10000+i.50000){s'
1116032
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to