Improving speed for long strings:

S=.;('label',":"0)&.>?~1000000
    #S
10888890

    ts '100{. (<;.1~key&E.) S'
0.462775 8.90691e7

    ts '100 ([: (<;.1~ key&E.) ] {.~ [ { key I.@E. ]) S'
0.030242 7.86938e6



Hallo Ric Sherlock, je schreef op 12-10-11 21:32:
> It may be worth noting that the following is supported by special code
> and will stop after finding the first occurrence of label in string.
>      label (E. i. 1:) string
> If string is long enough relative to the first 100 matches it may be
> worth iterating this operation 100 times, dropping to after the most
> recently found label each time.
>
>

-- 
Met vriendelijke groet,
=@@i

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to