User:RE Boss/Performance Records/Gray code

From J Wiki
Jump to navigation Jump to search

This page gives the outcome of a puzzle by Dan Bron, Gray Code. Contrary to there, the performance below was measured with y = 20.

Place Verb relperf ret res No. in GC Author
5 (3 : '(0&,. , 1&,.@|.)^:y i.1 0') 30.98 9.49 5.00 0 Roger Hui
8 (~:/\^:_1"1@:#:@i.@(2&^)) 382.59 130.22 4.50 1 Dan Bron
7 (3 : '(,:&:$: |.)/ i. y # 2') 240.57 113.37 3.25 2 Roger Hui, Raul Miller
4 ((, ,:;.0 + */@:$)^:(]`0:)) 7.33 4.08 2.75 3 Dan Bron
9 (2 ~:/\"1 0: ,. [: #:@:i. 2 ^ ]) 899.63 76.55 17.99 4 Dan Bron
6 (0 _1 (] ~: |.!.0) [: #:@:i. 2 ^ ]) 49.31 9.44 8.00 5 Dan Bron
2 ((22 b. _1: 33 b. ])@:(2 i.@:^ ])) 1.06 1.08 1.50 6 Dan Bron
3 ([: +/\ 0: , (, >:@# , -@|.)^:(]`($@0:))) 1.28 1.97 1.00 7 RE Boss
0 ([:>[:(({. * #@]) ,@:+ ($ (,: |.)))&.>/ (<0 1) ,~ 2: <@^ ]

((($~ *)@- +:@{:) , |.@]) i.@<.&.(2&^.))

1.00 1.00 1.53 8 RE Boss
1 ([: ({: (({. * #@]) ,@:+ ($ (,: |.)))((* #) ,@:+ # $

 (,: |.))^:({.`(0: , 1:))) ] (] , 2: ^ (- 2&^)) <.@(2&^.)@<:)

1.00 1.00 1.53 9 RE Boss


However, the output of the different verbs is not always comparible. There are the (classical) binary representation, as given by verbs 0 1 4 5 (No. in GC), and the base-2 values, as given by the rest, sometimes in high dimensional format.

   $&.>([:". ,&'(5)') &.> grayverbs
+----+----+-----------+---------+----+----+--+--+--+--+
|32 5|32 5|2 2 2 2 2 1|2 2 2 2 2|32 5|32 5|32|32|32|32|
+----+----+-----------+---------+----+----+--+--+--+--+

Although it was allowed in GC, the verbs are incomparable according to Performance Records.
So we are left with two records, one for binary and one for decimal Gray codes.

Binary Graycodes
Place Verb relperf ret res No. in GC Author
0 (3 : '(0&,. , 1&,.@|.)^:y i.1 0') 1.00 1.01 1.11 0 Roger Hui
2 (~:/\^:_1"1@:#:@i.@(2&^)) 12.35 13.79 1.00 1 Dan Bron
3 (2 ~:/\"1 0: ,. [: #:@:i. 2 ^ ]) 29.04 8.11 4.00 4 Dan Bron
1 (0 _1 (] ~: |.!.0) [: #:@:i. 2 ^ ]) 1.59 1.00 1.78 5 Dan Bron


Decimal value Graycodes
Place Verb relperf ret res No. in GC Author
5 (3 : '(,:&:$: |.)/ i. y # 2') 240.57 113.37 3.25 2 Roger Hui, Raul Miller
4 ((, ,:;.0 + */@:$)^:(]`0:)) 7.33 4.08 2.75 3 Dan Bron
2 ((22 b. _1: 33 b. ])@:(2 i.@:^ ])) 1.06 1.08 1.50 6 Dan Bron
3 ([: +/\ 0: , (, >:@# , -@|.)^:(]`($@0:))) 1.28 1.97 1.00 7 RE Boss
0 ([:>[:(({. * #@]) ,@:+ ($ (,: |.)))&.>/ (<0 1) ,~ 2: <@^ ]

((($~ *)@- +:@{:) , |.@]) i.@<.&.(2&^.))

1.00 1.00 1.53 8 RE Boss
1 ([: ({: (({. * #@]) ,@:+ ($ (,: |.)))((* #) ,@:+ # $

(,: |.))^:({.`(0: , 1:))) ] (] , 2: ^ (- 2&^)) <.@(2&^.)@<:)

1.00 1.00 1.53 9 RE Boss