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

Comparing liblzf/bench.c (file contents):
Revision 1.1 by root, Sun Jun 9 22:41:34 2002 UTC vs.
Revision 1.4 by root, Tue Nov 13 10:48:02 2007 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 4
5#include "lzf.h" 5#include "lzf.h"
6//#include "fastlz.c"
6 7
7typedef unsigned long tval; 8typedef unsigned long tval;
8typedef unsigned long long stamp64; 9typedef unsigned long long stamp64;
9 10
10extern inline tval stamp(void) 11extern inline tval stamp(void)
22 return tsc-t; 23 return tsc-t;
23 else 24 else
24 return t-tsc; 25 return t-tsc;
25} 26}
26 27
27#define DSIZE 1000000 28#define DSIZE 2821120
28 29
29unsigned char data[DSIZE], data2[DSIZE*2], data3[DSIZE*2]; 30unsigned char data[DSIZE], data2[DSIZE*2], data3[DSIZE*2];
30 31
31int main(void) 32int main(void)
32{ 33{
33 tval s; 34 tval s;
34 tval si[1000]; 35 tval si[1000];
35 int i, l, j; 36 int i, l, j;
36 int min = 1<<30; 37 int min = 1<<30;
38 int lp;
37 39
38 FILE *f = fopen ("data", "r"); 40 FILE *f = fopen ("data", "r");
39 fread (data, DSIZE, 1, f); 41 fread (data, DSIZE, 1, f);
40 fclose (f); 42 fclose (f);
41 43
42 for(;;) { 44 for (lp = 0; lp < 1000; lp++) {
43 s=stamp(); 45 s=stamp();
44 l = lzf_compress (data, DSIZE, data2, DSIZE*2); 46 l = lzf_compress (data, DSIZE, data2, DSIZE*2);
47 //l = fastlz_compress_level (1, data, DSIZE, data2);
48 si[0]=measure(s);
45 j = lzf_decompress (data2, l, data3, DSIZE*2); 49 j = lzf_decompress (data2, l, data3, DSIZE*2);
46 si[0]=measure(s);
47 50
48 printf ("\r%10d (%d) ", si[0], l); 51 printf ("\r%10d (%d) ", si[0], l);
49 if (si[0] < min && si[0] > 0) 52 if (si[0] < min && si[0] > 0)
50 { 53 {
51 printf ("\n"); 54 printf ("\n");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines