Thanks Henry, I have increased argument sizes and defined using tacit. I am still not seeing results that suggest the differences in the two approaches. Feel free to ignore if I am just running down a rabbit hole, but if it is useful here are my results.
JVERSION Engine: j902/j64avx2/darwin Beta-e: commercial/2020-08-14T13:00:52 Library: 9.02.05 Qt IDE: 1.8.7/5.12.7(5.12.7) Platform: Darwin 64 Installer: J902 install InstallPath: /users/bobtherriault/j902 Contact: www.jsoftware.com operand =. 2 2 2 $ 3 2 2 3 2 3 3 2 NB. original arguments bitmask =. 2 2 2 $ 1 0 0 1 0 1 1 0 roger =: 0&(] >:)"0 NB. tacit definitions henry =: >:@]^:["0 bitmask roger operand 4 2 2 4 2 4 4 2 bitmask henry operand 4 2 2 4 2 4 4 2 10 timespacex 'bitmask roger operand' 7e_7 1792 10 timespacex 'bitmask henry operand' 8e_7 1792 operand1 =. 200 200 200 $ 3 2 2 3 2 3 3 2 NB. larger arguments bitmask1 =. 200 200 200 $ 1 0 0 1 0 1 1 0 10 timespacex 'bitmask1 roger operand1' 0.342831 6.71104e7 10 timespacex 'bitmask1 henry operand1' 0.332431 6.71104e7 operand2 =. 2000 2000 200 $ 3 2 2 3 2 3 3 2 NB. even larger arguments bitmask2 =. 2000 2000 200 $ 1 0 0 1 0 1 1 0 timespacex 'bitmask2 roger operand2' NB. run only once because of time required to calculate 36.86 8.58994e9 timespacex 'bitmask2 henry operand2' 35.5014 8.58994e9 Cheers, bob > On Aug 17, 2020, at 07:54, Henry Rich <henryhr...@gmail.com> wrote: > > With arguments that small, most of the time is spent in lexing and parsing. > To test the time of execution, you need arguments long enough that the > execution dominates. Or, you can make a tacit verb that has done the parsing > in advance. > > To get serious measurements you need to delay the sampling until the process > has been CPU-bound long enough for the OS to change its scheduling mode from > interactive to batch. > > Henry Rich > > > > > > On 8/17/2020 10:45 AM, 'robert therriault' via Programming wrote: >> Thanks Henry, >> >> I woke up this morning realizing that the argument to & could be any value >> and that cleared up a lot of my fuzziness on what was going on. Thank you to >> Pascal as well for the explanation and Roger for twisting my brain for a few >> hours. >> >> operand =. 2 2 2 $ 3 2 2 3 2 3 3 2 >> >> bitmask =. 2 2 2 $ 1 0 0 1 0 1 1 0 >> >> operator =. >: >> >> bitmask 0&(] operator) operand NB. original >> 4 3 >> 3 4 >> >> 3 4 >> 4 3 >> bitmask 10&(] operator) operand NB. 10& same result >> 4 3 >> 3 4 >> >> 3 4 >> 4 3 >> bitmask ' '&(] operator) operand NB. type is not even important - ' '& >> works >> 4 3 >> 3 4 >> >> 3 4 >> 4 3 >> >> For efficiency, I don't see much difference between the two with these >> particular values >> 1000 timespacex ' bitmask 0&(] operator)"0 operand' >> 1.013e_6 2816 >> 1000 timespacex 'bitmask (operator@]^:[)"0 operand' >> 9.38e_7 2816 >> >> But the much simpler addition of the bitmask to the operand is 3 times >> faster and takes up half the space. >> 1000 timespacex 'bitmask + operand' >> 3.14e_7 1408 >> >> bitmask + operand >> 4 2 >> 2 4 >> >> 2 4 >> 4 2 >> >> Cheers, bob >> >> >>> On Aug 17, 2020, at 07:20, Henry Rich <henryhr...@gmail.com> wrote: >>> >>> In the example above, the 0& could be any value and is used only as a way >>> of getting the power function. >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm > > > -- > This email has been checked for viruses by AVG. > https://www.avg.com > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm