limit fstBC to 30bp in Python3 ver.
[GalaxyCodeBases.git] / c_cpp / lib / klib / test / kseq_bench2.c
blobb4154583bb29503c75925625c03f193cebc4f43a
1 #include <stdio.h>
2 #include <time.h>
3 #include <stdint.h>
4 #include <stdlib.h>
5 #include <fcntl.h>
6 #include "kseq.h"
7 KSTREAM_INIT(int, read, 4096)
9 #define BUF_SIZE 65536
11 int main(int argc, char *argv[])
13 clock_t t;
14 if (argc == 1) {
15 fprintf(stderr, "Usage: %s <in.txt>\n", argv[0]);
16 return 1;
19 FILE *fp;
20 char *s;
21 t = clock();
22 s = malloc(BUF_SIZE);
23 fp = fopen(argv[1], "r");
24 while (fgets(s, BUF_SIZE, fp));
25 fclose(fp);
26 fprintf(stderr, "[fgets] %.2f sec\n", (float)(clock() - t) / CLOCKS_PER_SEC);
29 int fd, dret;
30 kstream_t *ks;
31 kstring_t s;
32 t = clock();
33 s.l = s.m = 0; s.s = 0;
34 fd = open(argv[1], O_RDONLY);
35 ks = ks_init(fd);
36 while (ks_getuntil(ks, '\n', &s, &dret) >= 0);
37 free(s.s);
38 ks_destroy(ks);
39 close(fd);
40 fprintf(stderr, "[kstream] %.2f sec\n", (float)(clock() - t) / CLOCKS_PER_SEC);
42 return 0;