ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/liblzf/bench.c
(Generate patch)

Comparing liblzf/bench.c (file contents):
Revision 1.6 by root, Tue Nov 13 11:41:46 2007 UTC vs.
Revision 1.7 by root, Fri Feb 8 13:20:26 2008 UTC

1#include <stdio.h> 1#include <stdio.h>
2#include <assert.h> 2#include <assert.h>
3#include <string.h> 3#include <string.h>
4#include <time.h>
5#include <sys/time.h>
6#include <sys/types.h>
7#include <sys/socket.h>
8#include <sys/ioctl.h>
9#include <math.h>
10#include <X11/Xlib.h>
4 11
5#include "lzf.h" 12#include "lzf.h"
6//#include "fastlz.c" 13//#include "fastlz.c"
7 14
8typedef unsigned long tval; 15typedef unsigned long tval;
34 tval s; 41 tval s;
35 tval si[1000]; 42 tval si[1000];
36 int i, l, j; 43 int i, l, j;
37 int min = 1<<30; 44 int min = 1<<30;
38 int lp; 45 int lp;
46 char buf[8192];
47 int p[2];
48
49 pipe (p);
39 50
40 FILE *f = fopen ("data", "r"); 51 FILE *f = fopen ("data", "r");
41 fread (data, DSIZE, 1, f); 52 fread (data, DSIZE, 1, f);
42 fclose (f); 53 fclose (f);
43 54
44 for (lp = 0; lp < 1000; lp++) { 55 for (lp = 0; lp < 100000; lp++) {
45 s=stamp(); 56 s=stamp();
46 l = lzf_compress (data, DSIZE, data2, DSIZE*2); 57
47 //l = fastlz_compress_level (1, data, DSIZE, data2); 58 kill (0, 23);
59// write (p[1], &p, 1);
60// read (p[1], &i, 4);
61
48 si[0]=measure(s); 62 si[0]=measure(s);
63
49 j = lzf_decompress (data2, l, data3, DSIZE*2); 64 //j = lzf_decompress (data2, l, data3, DSIZE*2);
50 65
51 printf ("\r%10d (%d) ", si[0], l); 66 printf ("\r%10d (%d) ", si[0], l);
52 if (si[0] < min && si[0] > 0) 67 if (si[0] < min && si[0] > 0)
53 { 68 {
54 printf ("\n"); 69 printf ("\n");
55 min = si[0]; 70 min = si[0];
56 } 71 }
57 72
58 fflush (stdout); 73 fflush (stdout);
59 74
60 assert (memcmp (data, data3, DSIZE) == 0); 75 //assert (memcmp (data, data3, DSIZE) == 0);
61 } 76 }
62 return 0; 77 return 0;
63} 78}
64 79
65 80

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines