Skip to content

Commit

Permalink
changed the order
Browse files Browse the repository at this point in the history
  • Loading branch information
lh3 committed Apr 8, 2012
1 parent d992d40 commit b1faf38
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions test/kbit_test.c
Expand Up @@ -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();
Expand All @@ -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)
Expand All @@ -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;
}

0 comments on commit b1faf38

Please sign in to comment.