]> git.kaiwu.me - klib.git/commitdiff
changed the order
authorHeng Li <lh3@me.com>
Sun, 8 Apr 2012 23:39:42 +0000 (19:39 -0400)
committerHeng Li <lh3@me.com>
Sun, 8 Apr 2012 23:39:42 +0000 (19:39 -0400)
test/kbit_test.c

index 5d9bc6c0b727db45a076ecab2db13311906c2b90..393892a3cf398a5cf487778dc4861fe84d8be62a 100644 (file)
@@ -103,20 +103,6 @@ int main(void)
        for (i = 0; i < N; ++i)
                x[i] = (uint64_t)lrand48() << 32 | lrand48();
 
-       fprintf(stderr, "===> Count '%c' in 2-bit encoded integers <===\n", "ACGT"[c]);
-
-       t = clock();
-       for (j = 0, cnt = 0; j < M; ++j)
-               for (i = 0; i < N; ++i)
-                       cnt += kbi_DNAcount64(x[i], c);
-       fprintf(stderr, "%20s\t%20ld\t%10.3f\n", "kbit", (long)cnt, (double)(clock() - t) / CLOCKS_PER_SEC);
-
-       t = clock();
-       for (j = 0, cnt = 0; j < M; ++j)
-               for (i = 0; i < N; ++i)
-                       cnt += bt1_countInU64(x[i], c);
-       fprintf(stderr, "%20s\t%20ld\t%10.3f\n", "bowtie1", (long)cnt, (double)(clock() - t) / CLOCKS_PER_SEC);
-
        fprintf(stderr, "\n===> Calculate # of 1 in an integer (popcount) <===\n");
 
        t = clock();
@@ -129,7 +115,7 @@ int main(void)
        for (j = 0, cnt = 0; j < M; ++j)
                for (i = 0; i < N; ++i)
                        cnt += bt1_pop64(x[i]);
-       fprintf(stderr, "%20s\t%20ld\t%10.3f\n", "bowtie1", (long)cnt, (double)(clock() - t) / CLOCKS_PER_SEC);
+       fprintf(stderr, "%20s\t%20ld\t%10.3f\n", "wiki-popcount_2", (long)cnt, (double)(clock() - t) / CLOCKS_PER_SEC);
 
        t = clock();
        for (j = 0, cnt = 0; j < M; ++j)
@@ -142,6 +128,21 @@ int main(void)
                cnt += sse2_bit_count((__m128i*)x, (__m128i*)(x+N));
        fprintf(stderr, "%20s\t%20ld\t%10.3f\n", "SSE2-32bit", (long)cnt, (double)(clock() - t) / CLOCKS_PER_SEC);
 
+       fprintf(stderr, "\n===> Count '%c' in 2-bit encoded integers <===\n", "ACGT"[c]);
+
+       t = clock();
+       for (j = 0, cnt = 0; j < M; ++j)
+               for (i = 0; i < N; ++i)
+                       cnt += kbi_DNAcount64(x[i], c);
+       fprintf(stderr, "%20s\t%20ld\t%10.3f\n", "kbit", (long)cnt, (double)(clock() - t) / CLOCKS_PER_SEC);
+
+       t = clock();
+       for (j = 0, cnt = 0; j < M; ++j)
+               for (i = 0; i < N; ++i)
+                       cnt += bt1_countInU64(x[i], c);
+       fprintf(stderr, "%20s\t%20ld\t%10.3f\n", "bowtie1", (long)cnt, (double)(clock() - t) / CLOCKS_PER_SEC);
+
+       fprintf(stderr, "\n");
        free(x);
        return 0;
 }