> Did you do any timing on the "twice as fast"
L =: 'aAbB'
R =: 6e5 $ ,:'abcd'
] fast =: (50) 6!:2 'L cs R'
0.0660907
] slow =: (50) 6!:2 'L ($@:] $ (charsub ,)) R'
0.14676
slow % fast
2.22058
NB. Just so you don't think the $ $ , is the problem
r =: , R
] fast =: (50) 6!:2 'L cs r'
0.0651003
] slow =: (50) 6!:2 'L charsub r'
0.137288
slow % fast
2.10887
I suspect because this could be made even faster with judicious use of ~. (or
an equivalent): we're dealing stricly with
literals, and the literal universe is small. The problem is we'll need ~. to
work on atoms, not items, which means we require
y to be a rank-1 array. However, unlike y =. c } x ,: y , the phrase y =.
, y is not optimized, so we're likely to lose our
efficiency gains to a large memcopy.
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm