107f35bf07dd8c88468e07d7af8935e2947a7e2d — Martin Hafskjold Thoresen 7 months ago 583fe8d
Add stats stuff
4 files changed, 846 insertions(+), 67 deletions(-)

M main.c
A stats
A stats-sort
A stats.py
M main.c => main.c +52 -67
@@ 18,59 18,6 @@ static uint64_t TRUTH[2 * N];
 void asm_nb_rev(uint64_t *, size_t, uint64_t *, size_t, uint64_t *, size_t);
 void branching(uint64_t *, size_t, uint64_t *, size_t, uint64_t *, size_t);
 
-void sort_br2(uint64_t *xs, size_t n, uint64_t *buf, int *into_buf) {
-  switch (n) {
-  case 1:
-    *buf = *xs;
-  case 0:
-    *into_buf = 1;
-    return;
-  }
-  size_t h = n / 2;
-  int a_ib, b_ib;
-  sort_br2(xs, h, buf, &a_ib);
-  sort_br2(xs + h, n - h, buf + h, &b_ib);
-  *into_buf = a_ib ^ 1;
-  if (a_ib == 1) {
-    branching(buf, h, buf + h, n - h, xs, n);
-  } else {
-    branching(xs, h, xs + h, n - h, buf, n);
-  }
-}
-
-void sort_br(uint64_t *xs, size_t n, uint64_t *buf) {
-  int buf_contains_result;
-  sort_br2(xs, n, buf, &buf_contains_result);
-  if (buf_contains_result) {
-    memcpy(xs, buf, 8 * n);
-  }
-}
-
-void sort_asm2(uint64_t *xs, size_t n, uint64_t *buf, int *into_buf) {
-if (n < 2) {
-    *into_buf = 0;
-    return;
-  }
-  size_t h = n / 2;
-  int a_ib, b_ib;
-  sort_asm2(xs, h, buf, &a_ib);
-  sort_asm2(xs + h, n - h, buf + h, &b_ib);
-  *into_buf = a_ib ^ 1;
-  if (a_ib == 1) {
-    asm_nb_rev(buf, h, buf + h, n - h, xs, n);
-  } else {
-    asm_nb_rev(xs, h, xs + h, n - h, buf, n);
-  }
-}
-
-void sort_asm(uint64_t *xs, size_t n, uint64_t *buf) {
-  int buf_contains_result;
-  sort_asm2(xs, n, buf, &buf_contains_result);
-  if (buf_contains_result) {
-    memcpy(xs, buf, 8 * n);
-  }
-}
-
 // TODO: read and inline this into `take_time`.
 time diff(time start, time end) {
   time temp;


@@ 338,6 285,49 @@ void check(void) {
   }
 }
 
+#define SORT(variant)                                                \
+void sort_##variant##2(uint64_t *xs, size_t n, uint64_t *buf, int *into_buf) {\
+  switch (n) {                                                       \
+  case 1:                                                            \
+    *buf = *xs;                                                      \
+  case 0:                                                            \
+    *into_buf = 1;                                                   \
+    return;                                                          \
+  }                                                                  \
+  size_t h = n / 2;                                                  \
+  int a_ib, b_ib;                                                    \
+  sort_##variant##2(xs, h, buf, &a_ib);                              \
+  sort_##variant##2(xs + h, n - h, buf + h, &b_ib);                  \
+  *into_buf = a_ib ^ 1;                                              \
+  if (a_ib == 1) {                                                   \
+    variant(buf, h, buf + h, n - h, xs, n);                          \
+  } else {                                                           \
+    variant(xs, h, xs + h, n - h, buf, n);                           \
+  }                                                                  \
+}                                                                    \
+                                                                     \
+void sort_##variant(uint64_t *xs, size_t n, uint64_t *buf) {       \
+  int buf_contains_result;                                           \
+  sort_##variant##2(xs, n, buf, &buf_contains_result);               \
+  if (buf_contains_result) {                                         \
+    memcpy(xs, buf, 8 * n);                                          \
+  }                                                                  \
+}
+
+SORT(branching)
+SORT(nonbranching_but_branching)
+SORT(nonbranching)
+SORT(nonbranching_but_branching_reverse)
+SORT(nonbranching_reverse)
+SORT(nonbranching_reverse_ternary)
+SORT(asm_nb_rev)
+
+#define TIME_SORT(v)\
+  memset(ZS, 0, 8 * 2 * N);\
+  printf("%s: ", #v);\
+  TIME(v(XS, N, ZS));\
+  for (int i = 0; i < N; i++) XS[i] = YS[i];
+
 void sort_time(void) {
   for (int i = 0; i < 10; i++) {
     srand(i);


@@ 345,26 335,21 @@ void sort_time(void) {
       XS[i] = RAND();
       YS[i] = XS[i];
     }
-    memset(ZS, 0, 8 * 2 * N);
-    printf("asm:       ");
-    TIME(sort_asm(XS, N, ZS));
-
-    memset(ZS, 0, 8 * 2 * N);
-    printf("branching: ");
-    TIME(sort_br(YS, N, ZS));
 
-    for (int i = 0; i < N; i++) {
-      if (XS[i] != YS[i]) {
-        fprintf(stderr, "[%d]: XS=%zu\t YS=%zu\n", i, XS[i], YS[i]);
-      }
-    }
+    TIME_SORT(sort_branching)
+    TIME_SORT(sort_nonbranching_but_branching)
+    TIME_SORT(sort_nonbranching)
+    TIME_SORT(sort_nonbranching_but_branching_reverse)
+    TIME_SORT(sort_nonbranching_reverse)
+    TIME_SORT(sort_nonbranching_reverse_ternary)
+    TIME_SORT(sort_asm_nb_rev)
   }
 }
 
 int main(void) {
 
-  sort_time();
-  return 0;
+  // sort_time();
+  // return 0;
 
   fprintf(stderr, "Generating numbers and sorting them\n");
   prepare(0);

A stats => stats +700 -0
@@ 0,0 1,700 @@
+branching:                          0.309987166
+nonbranching_but_branching:         0.273185288
+nonbranching:                       0.247738959
+nonbranching_but_branching_reverse: 0.194128757
+nonbranching_reverse:               0.200105521
+nonbranching_reverse_ternary:       0.190348268
+asm_nb_rev:                         0.189678452
+branching:                          0.309842683
+nonbranching_but_branching:         0.273183118
+nonbranching:                       0.247611234
+nonbranching_but_branching_reverse: 0.193645670
+nonbranching_reverse:               0.200074286
+nonbranching_reverse_ternary:       0.190372972
+asm_nb_rev:                         0.189897702
+branching:                          0.309767946
+nonbranching_but_branching:         0.273338511
+nonbranching:                       0.247600493
+nonbranching_but_branching_reverse: 0.193638598
+nonbranching_reverse:               0.200064267
+nonbranching_reverse_ternary:       0.190448533
+asm_nb_rev:                         0.189852890
+branching:                          0.309928773
+nonbranching_but_branching:         0.273136737
+nonbranching:                       0.247630469
+nonbranching_but_branching_reverse: 0.193776493
+nonbranching_reverse:               0.199896609
+nonbranching_reverse_ternary:       0.190318098
+asm_nb_rev:                         0.189890242
+branching:                          0.309776299
+nonbranching_but_branching:         0.273103805
+nonbranching:                       0.247754341
+nonbranching_but_branching_reverse: 0.193594808
+nonbranching_reverse:               0.200027609
+nonbranching_reverse_ternary:       0.190315817
+asm_nb_rev:                         0.189677540
+branching:                          0.311007102
+nonbranching_but_branching:         0.273138426
+nonbranching:                       0.247588259
+nonbranching_but_branching_reverse: 0.193833019
+nonbranching_reverse:               0.199973513
+nonbranching_reverse_ternary:       0.190349170
+asm_nb_rev:                         0.189921830
+branching:                          0.309747937
+nonbranching_but_branching:         0.273101947
+nonbranching:                       0.247641424
+nonbranching_but_branching_reverse: 0.194119592
+nonbranching_reverse:               0.200196283
+nonbranching_reverse_ternary:       0.190426123
+asm_nb_rev:                         0.189711411
+branching:                          0.310012943
+nonbranching_but_branching:         0.272975475
+nonbranching:                       0.247903865
+nonbranching_but_branching_reverse: 0.193862375
+nonbranching_reverse:               0.200180786
+nonbranching_reverse_ternary:       0.190385055
+asm_nb_rev:                         0.189845729
+branching:                          0.309732538
+nonbranching_but_branching:         0.273296204
+nonbranching:                       0.247728917
+nonbranching_but_branching_reverse: 0.193948954
+nonbranching_reverse:               0.200070951
+nonbranching_reverse_ternary:       0.190315693
+asm_nb_rev:                         0.189788218
+branching:                          0.309905993
+nonbranching_but_branching:         0.273104500
+nonbranching:                       0.247693770
+nonbranching_but_branching_reverse: 0.193858102
+nonbranching_reverse:               0.200218893
+nonbranching_reverse_ternary:       0.190353442
+asm_nb_rev:                         0.189836026
+branching:                          0.310173584
+nonbranching_but_branching:         0.273210941
+nonbranching:                       0.247716559
+nonbranching_but_branching_reverse: 0.193806394
+nonbranching_reverse:               0.200111677
+nonbranching_reverse_ternary:       0.190374470
+asm_nb_rev:                         0.189759392
+branching:                          0.309882456
+nonbranching_but_branching:         0.273302814
+nonbranching:                       0.247621998
+nonbranching_but_branching_reverse: 0.194004208
+nonbranching_reverse:               0.200215616
+nonbranching_reverse_ternary:       0.190346332
+asm_nb_rev:                         0.189726160
+branching:                          0.309741945
+nonbranching_but_branching:         0.273027703
+nonbranching:                       0.247653001
+nonbranching_but_branching_reverse: 0.193816210
+nonbranching_reverse:               0.200053198
+nonbranching_reverse_ternary:       0.190354653
+asm_nb_rev:                         0.189708401
+branching:                          0.309820670
+nonbranching_but_branching:         0.273380136
+nonbranching:                       0.247745858
+nonbranching_but_branching_reverse: 0.193689475
+nonbranching_reverse:               0.200065306
+nonbranching_reverse_ternary:       0.190263470
+asm_nb_rev:                         0.189797280
+branching:                          0.310006914
+nonbranching_but_branching:         0.273038759
+nonbranching:                       0.247693918
+nonbranching_but_branching_reverse: 0.194043058
+nonbranching_reverse:               0.200158748
+nonbranching_reverse_ternary:       0.190361673
+asm_nb_rev:                         0.190726331
+branching:                          0.310019684
+nonbranching_but_branching:         0.273508139
+nonbranching:                       0.247641176
+nonbranching_but_branching_reverse: 0.193951734
+nonbranching_reverse:               0.200423077
+nonbranching_reverse_ternary:       0.190393564
+asm_nb_rev:                         0.189881369
+branching:                          0.309817925
+nonbranching_but_branching:         0.273191554
+nonbranching:                       0.247654341
+nonbranching_but_branching_reverse: 0.193846196
+nonbranching_reverse:               0.200587049
+nonbranching_reverse_ternary:       0.190533193
+asm_nb_rev:                         0.192317418
+branching:                          0.310051430
+nonbranching_but_branching:         0.276889230
+nonbranching:                       0.248067085
+nonbranching_but_branching_reverse: 0.194349389
+nonbranching_reverse:               0.200046412
+nonbranching_reverse_ternary:       0.190317701
+asm_nb_rev:                         0.190251487
+branching:                          0.310090403
+nonbranching_but_branching:         0.273249186
+nonbranching:                       0.247791089
+nonbranching_but_branching_reverse: 0.193782171
+nonbranching_reverse:               0.200838578
+nonbranching_reverse_ternary:       0.190292887
+asm_nb_rev:                         0.189724202
+branching:                          0.309995012
+nonbranching_but_branching:         0.273196358
+nonbranching:                       0.247635908
+nonbranching_but_branching_reverse: 0.193856821
+nonbranching_reverse:               0.200204143
+nonbranching_reverse_ternary:       0.190375163
+asm_nb_rev:                         0.189871711
+branching:                          0.309832668
+nonbranching_but_branching:         0.273090186
+nonbranching:                       0.247894560
+nonbranching_but_branching_reverse: 0.193675870
+nonbranching_reverse:               0.200107559
+nonbranching_reverse_ternary:       0.190365992
+asm_nb_rev:                         0.189729170
+branching:                          0.309850516
+nonbranching_but_branching:         0.273378290
+nonbranching:                       0.247642568
+nonbranching_but_branching_reverse: 0.193840297
+nonbranching_reverse:               0.200037972
+nonbranching_reverse_ternary:       0.190436065
+asm_nb_rev:                         0.189777964
+branching:                          0.310032953
+nonbranching_but_branching:         0.273522320
+nonbranching:                       0.247660837
+nonbranching_but_branching_reverse: 0.193987556
+nonbranching_reverse:               0.200315258
+nonbranching_reverse_ternary:       0.190352744
+asm_nb_rev:                         0.189802134
+branching:                          0.309854920
+nonbranching_but_branching:         0.273516571
+nonbranching:                       0.247690066
+nonbranching_but_branching_reverse: 0.193800781
+nonbranching_reverse:               0.200070715
+nonbranching_reverse_ternary:       0.190364661
+asm_nb_rev:                         0.189762182
+branching:                          0.309830100
+nonbranching_but_branching:         0.273153450
+nonbranching:                       0.247615111
+nonbranching_but_branching_reverse: 0.193885858
+nonbranching_reverse:               0.200283341
+nonbranching_reverse_ternary:       0.190363966
+asm_nb_rev:                         0.190046590
+branching:                          0.309691499
+nonbranching_but_branching:         0.273253467
+nonbranching:                       0.247708409
+nonbranching_but_branching_reverse: 0.193678601
+nonbranching_reverse:               0.200106122
+nonbranching_reverse_ternary:       0.190341109
+asm_nb_rev:                         0.189775812
+branching:                          0.310143085
+nonbranching_but_branching:         0.272862408
+nonbranching:                       0.247631781
+nonbranching_but_branching_reverse: 0.193635543
+nonbranching_reverse:               0.200169195
+nonbranching_reverse_ternary:       0.190392130
+asm_nb_rev:                         0.189827850
+branching:                          0.309874836
+nonbranching_but_branching:         0.273300555
+nonbranching:                       0.247644098
+nonbranching_but_branching_reverse: 0.193835360
+nonbranching_reverse:               0.200037790
+nonbranching_reverse_ternary:       0.190342474
+asm_nb_rev:                         0.189830769
+branching:                          0.309886181
+nonbranching_but_branching:         0.273301544
+nonbranching:                       0.247699973
+nonbranching_but_branching_reverse: 0.193875556
+nonbranching_reverse:               0.200087283
+nonbranching_reverse_ternary:       0.190420331
+asm_nb_rev:                         0.189733324
+branching:                          0.309973295
+nonbranching_but_branching:         0.273057966
+nonbranching:                       0.247649435
+nonbranching_but_branching_reverse: 0.194032898
+nonbranching_reverse:               0.200145000
+nonbranching_reverse_ternary:       0.190385489
+asm_nb_rev:                         0.189800856
+branching:                          0.310020433
+nonbranching_but_branching:         0.273227216
+nonbranching:                       0.247798767
+nonbranching_but_branching_reverse: 0.193934816
+nonbranching_reverse:               0.200175949
+nonbranching_reverse_ternary:       0.190372295
+asm_nb_rev:                         0.189703667
+branching:                          0.309775422
+nonbranching_but_branching:         0.273500657
+nonbranching:                       0.249618431
+nonbranching_but_branching_reverse: 0.193784294
+nonbranching_reverse:               0.200167277
+nonbranching_reverse_ternary:       0.190337211
+asm_nb_rev:                         0.189752873
+branching:                          0.309920681
+nonbranching_but_branching:         0.272788088
+nonbranching:                       0.247590233
+nonbranching_but_branching_reverse: 0.193929021
+nonbranching_reverse:               0.200043916
+nonbranching_reverse_ternary:       0.190394321
+asm_nb_rev:                         0.189832947
+branching:                          0.309846474
+nonbranching_but_branching:         0.273504063
+nonbranching:                       0.247756124
+nonbranching_but_branching_reverse: 0.193999020
+nonbranching_reverse:               0.200137142
+nonbranching_reverse_ternary:       0.190400422
+asm_nb_rev:                         0.189745045
+branching:                          0.309930473
+nonbranching_but_branching:         0.273277639
+nonbranching:                       0.247654305
+nonbranching_but_branching_reverse: 0.193852265
+nonbranching_reverse:               0.200116196
+nonbranching_reverse_ternary:       0.190382968
+asm_nb_rev:                         0.190452762
+branching:                          0.309964952
+nonbranching_but_branching:         0.273039448
+nonbranching:                       0.247676473
+nonbranching_but_branching_reverse: 0.193822904
+nonbranching_reverse:               0.200142157
+nonbranching_reverse_ternary:       0.190339439
+asm_nb_rev:                         0.189687718
+branching:                          0.311972449
+nonbranching_but_branching:         0.273483386
+nonbranching:                       0.247673502
+nonbranching_but_branching_reverse: 0.193780051
+nonbranching_reverse:               0.199985265
+nonbranching_reverse_ternary:       0.190387713
+asm_nb_rev:                         0.189785945
+branching:                          0.309906179
+nonbranching_but_branching:         0.273410276
+nonbranching:                       0.247682830
+nonbranching_but_branching_reverse: 0.194180704
+nonbranching_reverse:               0.200098344
+nonbranching_reverse_ternary:       0.190355321
+asm_nb_rev:                         0.189856884
+branching:                          0.309787041
+nonbranching_but_branching:         0.273225026
+nonbranching:                       0.247683920
+nonbranching_but_branching_reverse: 0.193795834
+nonbranching_reverse:               0.200109695
+nonbranching_reverse_ternary:       0.190457422
+asm_nb_rev:                         0.189840258
+branching:                          0.310256046
+nonbranching_but_branching:         0.273851525
+nonbranching:                       0.247729773
+nonbranching_but_branching_reverse: 0.193892762
+nonbranching_reverse:               0.200141676
+nonbranching_reverse_ternary:       0.190419610
+asm_nb_rev:                         0.190037876
+branching:                          0.309797937
+nonbranching_but_branching:         0.273022522
+nonbranching:                       0.247629824
+nonbranching_but_branching_reverse: 0.193764259
+nonbranching_reverse:               0.199990821
+nonbranching_reverse_ternary:       0.190262711
+asm_nb_rev:                         0.189748404
+branching:                          0.310435294
+nonbranching_but_branching:         0.273242528
+nonbranching:                       0.247713310
+nonbranching_but_branching_reverse: 0.193843203
+nonbranching_reverse:               0.200062936
+nonbranching_reverse_ternary:       0.190380267
+asm_nb_rev:                         0.189792502
+branching:                          0.309804309
+nonbranching_but_branching:         0.273471818
+nonbranching:                       0.247752717
+nonbranching_but_branching_reverse: 0.193920115
+nonbranching_reverse:               0.200169946
+nonbranching_reverse_ternary:       0.190358638
+asm_nb_rev:                         0.189784925
+branching:                          0.309923038
+nonbranching_but_branching:         0.273322971
+nonbranching:                       0.247611495
+nonbranching_but_branching_reverse: 0.193652873
+nonbranching_reverse:               0.200240660
+nonbranching_reverse_ternary:       0.190365444
+asm_nb_rev:                         0.189790733
+branching:                          0.309654995
+nonbranching_but_branching:         0.273140736
+nonbranching:                       0.247668857
+nonbranching_but_branching_reverse: 0.193896297
+nonbranching_reverse:               0.200153035
+nonbranching_reverse_ternary:       0.190455204
+asm_nb_rev:                         0.189799145
+branching:                          0.309814127
+nonbranching_but_branching:         0.274820456
+nonbranching:                       0.247614091
+nonbranching_but_branching_reverse: 0.193797397
+nonbranching_reverse:               0.200131623
+nonbranching_reverse_ternary:       0.190379644
+asm_nb_rev:                         0.189845661
+branching:                          0.309821276
+nonbranching_but_branching:         0.273494190
+nonbranching:                       0.247687945
+nonbranching_but_branching_reverse: 0.193982803
+nonbranching_reverse:               0.200114856
+nonbranching_reverse_ternary:       0.190349365
+asm_nb_rev:                         0.189756105
+branching:                          0.310210646
+nonbranching_but_branching:         0.273401607
+nonbranching:                       0.247665308
+nonbranching_but_branching_reverse: 0.193934831
+nonbranching_reverse:               0.200038772
+nonbranching_reverse_ternary:       0.190428690
+asm_nb_rev:                         0.189773906
+branching:                          0.309753904
+nonbranching_but_branching:         0.273381793
+nonbranching:                       0.247637312
+nonbranching_but_branching_reverse: 0.193808501
+nonbranching_reverse:               0.200160688
+nonbranching_reverse_ternary:       0.190314418
+asm_nb_rev:                         0.189664869
+branching:                          0.310256919
+nonbranching_but_branching:         0.273507621
+nonbranching:                       0.247567841
+nonbranching_but_branching_reverse: 0.193852546
+nonbranching_reverse:               0.200204976
+nonbranching_reverse_ternary:       0.190343783
+asm_nb_rev:                         0.191504814
+branching:                          0.309711539
+nonbranching_but_branching:         0.273220827
+nonbranching:                       0.247754700
+nonbranching_but_branching_reverse: 0.193829344
+nonbranching_reverse:               0.200087911
+nonbranching_reverse_ternary:       0.190335021
+asm_nb_rev:                         0.189786840
+branching:                          0.309989177
+nonbranching_but_branching:         0.272857941
+nonbranching:                       0.247732254
+nonbranching_but_branching_reverse: 0.193995090
+nonbranching_reverse:               0.200157883
+nonbranching_reverse_ternary:       0.190336107
+asm_nb_rev:                         0.189802121
+branching:                          0.309888377
+nonbranching_but_branching:         0.273141665
+nonbranching:                       0.247617379
+nonbranching_but_branching_reverse: 0.193831842
+nonbranching_reverse:               0.200096426
+nonbranching_reverse_ternary:       0.190399462
+asm_nb_rev:                         0.189772503
+branching:                          0.310761783
+nonbranching_but_branching:         0.273279818
+nonbranching:                       0.247694920
+nonbranching_but_branching_reverse: 0.193843328
+nonbranching_reverse:               0.200035180
+nonbranching_reverse_ternary:       0.190438466
+asm_nb_rev:                         0.189779767
+branching:                          0.309723261
+nonbranching_but_branching:         0.273494798
+nonbranching:                       0.247731614
+nonbranching_but_branching_reverse: 0.194031800
+nonbranching_reverse:               0.200123547
+nonbranching_reverse_ternary:       0.190333249
+asm_nb_rev:                         0.189668450
+branching:                          0.309544779
+nonbranching_but_branching:         0.273289350
+nonbranching:                       0.247655658
+nonbranching_but_branching_reverse: 0.193783550
+nonbranching_reverse:               0.200084817
+nonbranching_reverse_ternary:       0.190468820
+asm_nb_rev:                         0.189774861
+branching:                          0.309890659
+nonbranching_but_branching:         0.273348367
+nonbranching:                       0.247596921
+nonbranching_but_branching_reverse: 0.194021806
+nonbranching_reverse:               0.200063679
+nonbranching_reverse_ternary:       0.190359080
+asm_nb_rev:                         0.189871133
+branching:                          0.309764854
+nonbranching_but_branching:         0.273288678
+nonbranching:                       0.247641316
+nonbranching_but_branching_reverse: 0.194200108
+nonbranching_reverse:               0.200238174
+nonbranching_reverse_ternary:       0.190367978
+asm_nb_rev:                         0.189692800
+branching:                          0.310064569
+nonbranching_but_branching:         0.273209259
+nonbranching:                       0.247639610
+nonbranching_but_branching_reverse: 0.193954758
+nonbranching_reverse:               0.200174703
+nonbranching_reverse_ternary:       0.190358660
+asm_nb_rev:                         0.189664240
+branching:                          0.309803636
+nonbranching_but_branching:         0.273268885
+nonbranching:                       0.247656897
+nonbranching_but_branching_reverse: 0.193736691
+nonbranching_reverse:               0.200062304
+nonbranching_reverse_ternary:       0.190399412
+asm_nb_rev:                         0.189863614
+branching:                          0.310292198
+nonbranching_but_branching:         0.273582161
+nonbranching:                       0.247651475
+nonbranching_but_branching_reverse: 0.193922592
+nonbranching_reverse:               0.200248916
+nonbranching_reverse_ternary:       0.190367379
+asm_nb_rev:                         0.189631504
+branching:                          0.309730805
+nonbranching_but_branching:         0.273400340
+nonbranching:                       0.247599257
+nonbranching_but_branching_reverse: 0.193739831
+nonbranching_reverse:               0.200027718
+nonbranching_reverse_ternary:       0.190372966
+asm_nb_rev:                         0.189682728
+branching:                          0.309862783
+nonbranching_but_branching:         0.273029247
+nonbranching:                       0.247671098
+nonbranching_but_branching_reverse: 0.193802876
+nonbranching_reverse:               0.200037947
+nonbranching_reverse_ternary:       0.190364055
+asm_nb_rev:                         0.189691194
+branching:                          0.310021307
+nonbranching_but_branching:         0.273269782
+nonbranching:                       0.247768946
+nonbranching_but_branching_reverse: 0.193834899
+nonbranching_reverse:               0.200105759
+nonbranching_reverse_ternary:       0.190376954
+asm_nb_rev:                         0.189718254
+branching:                          0.309823490
+nonbranching_but_branching:         0.273565676
+nonbranching:                       0.247754628
+nonbranching_but_branching_reverse: 0.193943758
+nonbranching_reverse:               0.200423494
+nonbranching_reverse_ternary:       0.190325930
+asm_nb_rev:                         0.189762440
+branching:                          0.310004240
+nonbranching_but_branching:         0.273261804
+nonbranching:                       0.247695975
+nonbranching_but_branching_reverse: 0.193905263
+nonbranching_reverse:               0.200175526
+nonbranching_reverse_ternary:       0.190380669
+asm_nb_rev:                         0.189708019
+branching:                          0.311618322
+nonbranching_but_branching:         0.273067483
+nonbranching:                       0.247649495
+nonbranching_but_branching_reverse: 0.193804049
+nonbranching_reverse:               0.200243882
+nonbranching_reverse_ternary:       0.190349021
+asm_nb_rev:                         0.189711855
+branching:                          0.309937519
+nonbranching_but_branching:         0.273149801
+nonbranching:                       0.247627809
+nonbranching_but_branching_reverse: 0.193740266
+nonbranching_reverse:               0.200154904
+nonbranching_reverse_ternary:       0.190347049
+asm_nb_rev:                         0.189699862
+branching:                          0.309748478
+nonbranching_but_branching:         0.273030038
+nonbranching:                       0.247659369
+nonbranching_but_branching_reverse: 0.193857719
+nonbranching_reverse:               0.200160220
+nonbranching_reverse_ternary:       0.190337750
+asm_nb_rev:                         0.189705526
+branching:                          0.310395383
+nonbranching_but_branching:         0.273073216
+nonbranching:                       0.247635133
+nonbranching_but_branching_reverse: 0.193709464
+nonbranching_reverse:               0.200040521
+nonbranching_reverse_ternary:       0.190400172
+asm_nb_rev:                         0.189804137
+branching:                          0.309722399
+nonbranching_but_branching:         0.272862135
+nonbranching:                       0.247676517
+nonbranching_but_branching_reverse: 0.193749535
+nonbranching_reverse:               0.200414358
+nonbranching_reverse_ternary:       0.190335583
+asm_nb_rev:                         0.189681364
+branching:                          0.310981233
+nonbranching_but_branching:         0.273177642
+nonbranching:                       0.247617192
+nonbranching_but_branching_reverse: 0.193811078
+nonbranching_reverse:               0.200014575
+nonbranching_reverse_ternary:       0.190377198
+asm_nb_rev:                         0.189871791
+branching:                          0.309996413
+nonbranching_but_branching:         0.272760868
+nonbranching:                       0.247626251
+nonbranching_but_branching_reverse: 0.193790147
+nonbranching_reverse:               0.200059938
+nonbranching_reverse_ternary:       0.190339922
+asm_nb_rev:                         0.189813259
+branching:                          0.310319983
+nonbranching_but_branching:         0.272992000
+nonbranching:                       0.248009720
+nonbranching_but_branching_reverse: 0.193670471
+nonbranching_reverse:               0.200059796
+nonbranching_reverse_ternary:       0.190323521
+asm_nb_rev:                         0.189765141
+branching:                          0.309759625
+nonbranching_but_branching:         0.273195880
+nonbranching:                       0.247610391
+nonbranching_but_branching_reverse: 0.193569403
+nonbranching_reverse:               0.200057385
+nonbranching_reverse_ternary:       0.190287458
+asm_nb_rev:                         0.191503359
+branching:                          0.310253349
+nonbranching_but_branching:         0.273286040
+nonbranching:                       0.247667291
+nonbranching_but_branching_reverse: 0.193740677
+nonbranching_reverse:               0.200495469
+nonbranching_reverse_ternary:       0.190339494
+asm_nb_rev:                         0.189695167
+branching:                          0.309643924
+nonbranching_but_branching:         0.273514111
+nonbranching:                       0.247742624
+nonbranching_but_branching_reverse: 0.193905545
+nonbranching_reverse:               0.200101850
+nonbranching_reverse_ternary:       0.190469885
+asm_nb_rev:                         0.189902504
+branching:                          0.309696591
+nonbranching_but_branching:         0.273450106
+nonbranching:                       0.247630885
+nonbranching_but_branching_reverse: 0.193883773
+nonbranching_reverse:               0.200029836
+nonbranching_reverse_ternary:       0.190405201
+asm_nb_rev:                         0.189865053
+branching:                          0.309838787
+nonbranching_but_branching:         0.273490012
+nonbranching:                       0.247664241
+nonbranching_but_branching_reverse: 0.193757543
+nonbranching_reverse:               0.200141083
+nonbranching_reverse_ternary:       0.190402407
+asm_nb_rev:                         0.189804042
+branching:                          0.309820345
+nonbranching_but_branching:         0.272786689
+nonbranching:                       0.247662964
+nonbranching_but_branching_reverse: 0.193930579
+nonbranching_reverse:               0.200122397
+nonbranching_reverse_ternary:       0.190721594
+asm_nb_rev:                         0.189794170
+branching:                          0.309611842
+nonbranching_but_branching:         0.273034841
+nonbranching:                       0.247589727
+nonbranching_but_branching_reverse: 0.194037123
+nonbranching_reverse:               0.200109213
+nonbranching_reverse_ternary:       0.190365068
+asm_nb_rev:                         0.189760781
+branching:                          0.309964414
+nonbranching_but_branching:         0.273298735
+nonbranching:                       0.247639297
+nonbranching_but_branching_reverse: 0.194252859
+nonbranching_reverse:               0.200075315
+nonbranching_reverse_ternary:       0.190444858
+asm_nb_rev:                         0.189876380
+branching:                          0.309843867
+nonbranching_but_branching:         0.273317074
+nonbranching:                       0.247642184
+nonbranching_but_branching_reverse: 0.194036196
+nonbranching_reverse:               0.200129141
+nonbranching_reverse_ternary:       0.190445852
+asm_nb_rev:                         0.189891880
+branching:                          0.309951239
+nonbranching_but_branching:         0.273560600
+nonbranching:                       0.247681047
+nonbranching_but_branching_reverse: 0.193801220
+nonbranching_reverse:               0.200098096
+nonbranching_reverse_ternary:       0.190451062
+asm_nb_rev:                         0.189695897
+branching:                          0.309753152
+nonbranching_but_branching:         0.273463514
+nonbranching:                       0.247959619
+nonbranching_but_branching_reverse: 0.193714872
+nonbranching_reverse:               0.200053258
+nonbranching_reverse_ternary:       0.190465676
+asm_nb_rev:                         0.189720702
+branching:                          0.309850049
+nonbranching_but_branching:         0.273049825
+nonbranching:                       0.247754999
+nonbranching_but_branching_reverse: 0.193870287
+nonbranching_reverse:               0.200264734
+nonbranching_reverse_ternary:       0.190399545
+asm_nb_rev:                         0.189889303
+branching:                          0.309803158
+nonbranching_but_branching:         0.272972319
+nonbranching:                       0.247691792
+nonbranching_but_branching_reverse: 0.193839940
+nonbranching_reverse:               0.200496814
+nonbranching_reverse_ternary:       0.190425251
+asm_nb_rev:                         0.189870011
+branching:                          0.309882808
+nonbranching_but_branching:         0.272909506
+nonbranching:                       0.247595700
+nonbranching_but_branching_reverse: 0.193869733
+nonbranching_reverse:               0.200067413
+nonbranching_reverse_ternary:       0.190372150
+asm_nb_rev:                         0.189829314
+branching:                          0.309898303
+nonbranching_but_branching:         0.273593304
+nonbranching:                       0.247839866
+nonbranching_but_branching_reverse: 0.193885728
+nonbranching_reverse:               0.200079208
+nonbranching_reverse_ternary:       0.190381974
+asm_nb_rev:                         0.189781048
+branching:                          0.309862964
+nonbranching_but_branching:         0.273573120
+nonbranching:                       0.247633663
+nonbranching_but_branching_reverse: 0.193723200
+nonbranching_reverse:               0.200110800
+nonbranching_reverse_ternary:       0.190453583
+asm_nb_rev:                         0.189806632
+branching:                          0.309827274
+nonbranching_but_branching:         0.272947383
+nonbranching:                       0.247611279
+nonbranching_but_branching_reverse: 0.193871121
+nonbranching_reverse:               0.200097307
+nonbranching_reverse_ternary:       0.190442486
+asm_nb_rev:                         0.189864431
+branching:                          0.309768669
+nonbranching_but_branching:         0.273435651
+nonbranching:                       0.247565083
+nonbranching_but_branching_reverse: 0.193980871
+nonbranching_reverse:               0.200099051
+nonbranching_reverse_ternary:       0.190361041
+asm_nb_rev:                         0.189800243
+branching:                          0.309766193
+nonbranching_but_branching:         0.273326868
+nonbranching:                       0.247654757
+nonbranching_but_branching_reverse: 0.194065134
+nonbranching_reverse:               0.200635393
+nonbranching_reverse_ternary:       0.190448115
+asm_nb_rev:                         0.189779812
+branching:                          0.309969819
+nonbranching_but_branching:         0.273034340
+nonbranching:                       0.247619626
+nonbranching_but_branching_reverse: 0.194013120
+nonbranching_reverse:               0.200164616
+nonbranching_reverse_ternary:       0.190364628
+asm_nb_rev:                         0.189745934
+branching:                          0.309722104
+nonbranching_but_branching:         0.273486792
+nonbranching:                       0.247678504
+nonbranching_but_branching_reverse: 0.193931218
+nonbranching_reverse:               0.200093077
+nonbranching_reverse_ternary:       0.190424575
+asm_nb_rev:                         0.189758622
+branching:                          0.310030343
+nonbranching_but_branching:         0.273100080
+nonbranching:                       0.247683050
+nonbranching_but_branching_reverse: 0.194013993
+nonbranching_reverse:               0.200094642
+nonbranching_reverse_ternary:       0.190444451
+asm_nb_rev:                         0.189772576
+branching:                          0.309759216
+nonbranching_but_branching:         0.273406156
+nonbranching:                       0.247569456
+nonbranching_but_branching_reverse: 0.193548121
+nonbranching_reverse:               0.199998744
+nonbranching_reverse_ternary:       0.190378883
+asm_nb_rev:                         0.189813768
+branching:                          0.309697599
+nonbranching_but_branching:         0.273445559
+nonbranching:                       0.247720689
+nonbranching_but_branching_reverse: 0.194175350
+nonbranching_reverse:               0.200152094
+nonbranching_reverse_ternary:       0.190509487
+asm_nb_rev:                         0.189718448
+branching:                          0.310747376
+nonbranching_but_branching:         0.273468243
+nonbranching:                       0.247552211
+nonbranching_but_branching_reverse: 0.193665507
+nonbranching_reverse:               0.200084902
+nonbranching_reverse_ternary:       0.190421078
+asm_nb_rev:                         0.190494436
+branching:                          0.310197544
+nonbranching_but_branching:         0.273529992
+nonbranching:                       0.247872308
+nonbranching_but_branching_reverse: 0.193806761
+nonbranching_reverse:               0.200111551
+nonbranching_reverse_ternary:       0.190423691
+asm_nb_rev:                         0.189810314

A stats-sort => stats-sort +70 -0
@@ 0,0 1,70 @@
+sort_branching: 3.694477834
+sort_nonbranching_but_branching: 3.245252702
+sort_nonbranching: 3.259176079
+sort_nonbranching_but_branching_reverse: 2.788129642
+sort_nonbranching_reverse: 2.840047749
+sort_nonbranching_reverse_ternary: 2.706840964
+sort_asm_nb_rev: 2.702593209
+sort_branching: 3.693856630
+sort_nonbranching_but_branching: 3.243603380
+sort_nonbranching: 3.257212637
+sort_nonbranching_but_branching_reverse: 2.791641837
+sort_nonbranching_reverse: 2.838682119
+sort_nonbranching_reverse_ternary: 2.705611786
+sort_asm_nb_rev: 2.701836105
+sort_branching: 3.696839099
+sort_nonbranching_but_branching: 3.241926136
+sort_nonbranching: 3.256993215
+sort_nonbranching_but_branching_reverse: 2.792168770
+sort_nonbranching_reverse: 2.841339785
+sort_nonbranching_reverse_ternary: 2.706837772
+sort_asm_nb_rev: 2.703179659
+sort_branching: 3.695283124
+sort_nonbranching_but_branching: 3.242846586
+sort_nonbranching: 3.254664774
+sort_nonbranching_but_branching_reverse: 2.789921576
+sort_nonbranching_reverse: 2.837856762
+sort_nonbranching_reverse_ternary: 2.708122923
+sort_asm_nb_rev: 2.703155577
+sort_branching: 3.696046158
+sort_nonbranching_but_branching: 3.244279597
+sort_nonbranching: 3.259306654
+sort_nonbranching_but_branching_reverse: 2.788257215
+sort_nonbranching_reverse: 2.835934673
+sort_nonbranching_reverse_ternary: 2.705617627
+sort_asm_nb_rev: 2.702532465
+sort_branching: 3.689661696
+sort_nonbranching_but_branching: 3.240951659
+sort_nonbranching: 3.254479115
+sort_nonbranching_but_branching_reverse: 2.797288547
+sort_nonbranching_reverse: 2.842264207
+sort_nonbranching_reverse_ternary: 2.708164824
+sort_asm_nb_rev: 2.702015345
+sort_branching: 3.698286641
+sort_nonbranching_but_branching: 3.243717009
+sort_nonbranching: 3.255164067
+sort_nonbranching_but_branching_reverse: 2.790565403
+sort_nonbranching_reverse: 2.838806501
+sort_nonbranching_reverse_ternary: 2.706998113
+sort_asm_nb_rev: 2.702775503
+sort_branching: 3.693591156
+sort_nonbranching_but_branching: 3.242864861
+sort_nonbranching: 3.255836200
+sort_nonbranching_but_branching_reverse: 2.794298034
+sort_nonbranching_reverse: 2.839115616
+sort_nonbranching_reverse_ternary: 2.705850622
+sort_asm_nb_rev: 2.702297666
+sort_branching: 3.694903805
+sort_nonbranching_but_branching: 3.243821043
+sort_nonbranching: 3.255381882
+sort_nonbranching_but_branching_reverse: 2.801575742
+sort_nonbranching_reverse: 2.840922194
+sort_nonbranching_reverse_ternary: 2.707209673
+sort_asm_nb_rev: 2.702635256
+sort_branching: 3.694916821
+sort_nonbranching_but_branching: 3.244452482
+sort_nonbranching: 3.257581992
+sort_nonbranching_but_branching_reverse: 2.789873734
+sort_nonbranching_reverse: 2.837758863
+sort_nonbranching_reverse_ternary: 2.705496405
+sort_asm_nb_rev: 2.699746108

A stats.py => stats.py +24 -0
@@ 0,0 1,24 @@
+import sys
+from collections import defaultdict
+
+def avg(ns):
+    n = len(ns)
+    return sum(ns) / n
+
+def var(ns):
+    mu = avg(ns)
+    return avg([(n - mu)**2 for n in ns])
+
+d = defaultdict(list)
+
+for line in sys.stdin.readlines():
+    sp = line.split(' ')
+    name = sp[0]
+    num = 100.0 * float(sp[-1].strip())
+    d[name].append(num)
+
+
+slen = int(max([len(s) for s in d.keys()]))
+
+for name, ns in d.items():
+    print('{0:{1}} {2:3.3f} +/- {3:1.3f}'.format(name, slen, avg(ns), var(ns)))