9 KSTREAM_INIT(gzFile
, gzread
, BUF_SIZE
)
11 int main(int argc
, char *argv
[])
16 fprintf(stderr
, "Usage: kseq_bench <in.gz>\n");
20 uint8_t *buf
= malloc(BUF_SIZE
);
21 fp
= gzopen(argv
[1], "r");
23 while (gzread(fp
, buf
, BUF_SIZE
) > 0);
24 fprintf(stderr
, "[gzread] %.2f sec\n", (float)(clock() - t
) / CLOCKS_PER_SEC
);
30 fp
= gzopen(argv
[1], "r");
33 while (ks_getc(ks
) >= 0);
34 fprintf(stderr
, "[ks_getc] %.2f sec\n", (float)(clock() - t
) / CLOCKS_PER_SEC
);
42 s
= calloc(1, sizeof(kstring_t
));
43 fp
= gzopen(argv
[1], "r");
46 while (ks_getuntil(ks
, '\n', s
, &dret
) >= 0);
47 fprintf(stderr
, "[ks_getuntil] %.2f sec\n", (float)(clock() - t
) / CLOCKS_PER_SEC
);
53 fp
= gzopen(argv
[1], "r");
55 while (gzgetc(fp
) >= 0);
56 fprintf(stderr
, "[gzgetc] %.2f sec\n", (float)(clock() - t
) / CLOCKS_PER_SEC
);
60 char *buf
= malloc(BUF_SIZE
);
61 fp
= gzopen(argv
[1], "r");
63 while (gzgets(fp
, buf
, BUF_SIZE
) > 0);
64 fprintf(stderr
, "[gzgets] %.2f sec\n", (float)(clock() - t
) / CLOCKS_PER_SEC
);