I was fiddling with patterns in the first 10e9 digits of Pi this evening and 
was surprised by a timing.

Rather than what I was fooling with, I put it into a smaller easily reproduced 
example, to wit -

MBpro-3:JKTststs jkt$ ja
   JVERSION
Engine: j807/j64/darwin
Release-e: commercial/2019-11-04T12:57:58
Library: 8.07.26
Platform: Darwin 64
Installer: J807 install
InstallPath: /applications/j64-807
Contact: www.jsoftware.com
   20?.@$ 2
0 1 0 1 1 0 0 1 1 1 0 0 0 0 1 0 0 0 1 0
   rl
[: #;.1~ 1 , 2 ~:/\ ]
   rl 20?.@$ 2
1 1 1 2 2 3 4 1 3 1 1
   q=. (50e6 ?.@$ 10){'0123456789'
   timex 'z=. rl q'
1.720735 649991296
   hist 
~. ,: #/.~
   hist z
       1      3       2     4    5  7   6 8 9
40500537 405764 4048327 40574 4095 35 410 4 1
   NB. i.e. one run of 9 digits, 4 of length 8 etc.
   timex 'hist z'
0.295335 536872960
   exit 0

MBpro-3:JKTststs jkt$ jb
   JVERSION
Engine: j901/j64avx2/darwin
Release-c: commercial/2020-01-11T12:24:26
Library: 9.01.18
Platform: Darwin 64
Installer: J901 install
InstallPath: /applications/j901
Contact: www.jsoftware.com
   q=. (50e6 ?.@$ 10){'0123456789'
   timex 'z=. rl q'
6.56145 649995392
   hist z
       1      3       2     4    5  7   6 8 9
40500537 405764 4048327 40574 4095 35 410 4 1
   6.56145 % 1.720735
3.813167048
   exit 0
MBpro-3:JKTststs jkt$ 

What surprised me was that the run length function rl took more space and about 
4 times  as long in J9.01 as in J8.07 - most things I try are the other way 
around. 

Have others had similar experiences?
 
Does anyone see a reason my run length verb should bog down?

- joey


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

Reply via email to