Browse Source

lol it's faster.

Michele Orrù 7 years ago
parent
commit
2e5581fc6c
3 changed files with 7 additions and 5 deletions
  1. 1 2
      configure.ac
  2. 5 2
      src/ddlog.c
  3. 1 1
      src/ddlog_bench.c

+ 1 - 2
configure.ac

@@ -54,8 +54,7 @@ AC_ARG_ENABLE(debug,
    CFLAGS+=" -UNDEBUG -O0 -ggdb -fbounds-check -D_FORTIFY_SOURCE=1",
    CFLAGS+=" -DNDEBUG -O3 -march=native")
 
-
-AC_DEFINE([FAILURE],  [9], [log inverse of the failure probability, default: 17.])
+AC_DEFINE([FAILURE],  [17], [log inverse of the failure probability, default: 17.])
 AC_DEFINE([FB_BASE], [10], [log of precomputed base for group operation, default: 8.])
 AC_DEFINE([SS_BASE], [1], [log of secret shares representation, default: 1.])
 

+ 5 - 2
src/ddlog.c

@@ -44,10 +44,9 @@ uint32_t __attribute__((optimize("unroll-loops"))) convert(uint64_t * nn)
 #define next_head  ((head + 23) % 24)
 #define tail       ((head + 1)  % 24)
 #define next_tail  ((head + 2)  % 24)
-#define x (nn[head])
-#define y (nn[next_head])
 
   /** Check the most significant block */
+  const uint64_t x = nn[head];
   for (uint32_t w2 = clz(x) + halfstrip_size - (clz(x) % halfstrip_size);
        w2 < 64 - halfstrip_size;
        w2 += halfstrip_size) {
@@ -59,6 +58,9 @@ uint32_t __attribute__((optimize("unroll-loops"))) convert(uint64_t * nn)
   }
 
   for (steps = 64; true; steps += 64) {
+    const uint64_t x = nn[head];
+    const uint64_t y = nn[next_head];
+
     if (!(x & bottommask)) {
       const size_t previous = (x >> halfstrip_size) & bottommask;
       const uint32_t next   =  y >> (64 - halfstrip_size);
@@ -89,6 +91,7 @@ uint32_t __attribute__((optimize("unroll-loops"))) convert(uint64_t * nn)
     nn[tail] = al;
     add_1(nn, next_tail, 24, ah);
   }
+
 }
 
 bool distinguished(mpz_t n)

+ 1 - 1
src/ddlog_bench.c

@@ -15,7 +15,7 @@ int main()
   mpz_entropy_init();
 
   INIT_TIMEIT(CLOCK_PROCESS_CPUTIME_ID);
-  for (int i=0; i < (int) (1e6); i++) {
+  for (int i=0; i < (int) (1e9 / (0x01 << strip_size) * 3.5); i++) {
     mpz_t n, n0;
     mpz_inits(n, n0, NULL);