E. does use Boyer-Moore.  However, +./@:E. or E.i.1: exits on finding the
first match so can be much faster; at the very least, they do not have to
construct the boolean vector first.  See Appendix B
<http://www.jsoftware.com/help/dictionary/special.htm> of the J dictionary.

   x=: 'abra'
   y=: 1e6$'abracadabra '

   timer=: 6!:2

   10 timer '(x E. y)i.1'
0.00988289
   10 timer 'x (E.i.1:) y'
4.66504e_6

   A=: 'not in '
   10 timer '(A E. y)i.1'
0.00573889
   10 timer 'A (E.i.1:) y'
0.00455509



On Thu, Aug 28, 2014 at 4:23 PM, Henry Rich <henryhr...@nc.rr.com> wrote:

> Remember that x +./@:E. y, x i.&1@:E. y, etc use Boyer-Moore, so
> potentially much faster.
>
> Henry Rich
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to