1f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com#include "SpeedTest.h"
2f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
3f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com#include "Random.h"
4f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
5f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com#include <stdio.h>   // for printf
6f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com#include <memory.h>  // for memset
7f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com#include <math.h>    // for sqrt
8f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com#include <algorithm> // for sort
9f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
10f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com//-----------------------------------------------------------------------------
11f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com// We view our timing values as a series of random variables V that has been
12f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com// contaminated with occasional outliers due to cache misses, thread
13f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com// preemption, etcetera. To filter out the outliers, we search for the largest
14f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com// subset of V such that all its values are within three standard deviations
15f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com// of the mean.
16f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
17f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.comdouble CalcMean ( std::vector<double> & v )
18f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com{
19f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  double mean = 0;
20f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
21f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  for(int i = 0; i < (int)v.size(); i++)
22f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  {
23f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    mean += v[i];
24f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  }
25f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
26f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  mean /= double(v.size());
27f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
28f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  return mean;
29f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com}
30f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
31f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.comdouble CalcMean ( std::vector<double> & v, int a, int b )
32f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com{
33f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  double mean = 0;
34f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
35f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  for(int i = a; i <= b; i++)
36f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  {
37f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    mean += v[i];
38f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  }
39f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
40f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  mean /= (b-a+1);
41f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
42f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  return mean;
43f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com}
44f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
45f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.comdouble CalcStdv ( std::vector<double> & v, int a, int b )
46f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com{
47f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  double mean = CalcMean(v,a,b);
48f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
49f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  double stdv = 0;
50f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
51f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  for(int i = a; i <= b; i++)
52f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  {
53f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    double x = v[i] - mean;
54f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
55f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    stdv += x*x;
56f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  }
57f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
58f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  stdv = sqrt(stdv / (b-a+1));
59f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
60f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  return stdv;
61f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com}
62f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
63f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com// Return true if the largest value in v[0,len) is more than three
64f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com// standard deviations from the mean
65f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
66f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.combool ContainsOutlier ( std::vector<double> & v, size_t len )
67f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com{
68f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  double mean = 0;
69f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
70f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  for(size_t i = 0; i < len; i++)
71f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  {
72f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    mean += v[i];
73f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  }
74f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
75f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  mean /= double(len);
76f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
77f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  double stdv = 0;
78f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
79f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  for(size_t i = 0; i < len; i++)
80f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  {
81f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    double x = v[i] - mean;
82f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    stdv += x*x;
83f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  }
84f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
85f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  stdv = sqrt(stdv / double(len));
86f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
87f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  double cutoff = mean + stdv*3;
88f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
89f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  return v[len-1] > cutoff;
90f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com}
91f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
92f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com// Do a binary search to find the largest subset of v that does not contain
93f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com// outliers.
94f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
95f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.comvoid FilterOutliers ( std::vector<double> & v )
96f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com{
97f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  std::sort(v.begin(),v.end());
98f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
99f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  size_t len = 0;
100f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
101f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  for(size_t x = 0x40000000; x; x = x >> 1 )
102f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  {
103f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    if((len | x) >= v.size()) continue;
104f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
105f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    if(!ContainsOutlier(v,len | x))
106f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    {
107f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com      len |= x;
108f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    }
109f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  }
110f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
111f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  v.resize(len);
112f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com}
113f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
114f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com// Iteratively tighten the set to find a subset that does not contain
115f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com// outliers. I'm not positive this works correctly in all cases.
116f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
117f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.comvoid FilterOutliers2 ( std::vector<double> & v )
118f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com{
119f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  std::sort(v.begin(),v.end());
120f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
121f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  int a = 0;
122f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  int b = (int)(v.size() - 1);
123f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
124f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  for(int i = 0; i < 10; i++)
125f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  {
126f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    //printf("%d %d\n",a,b);
127f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
128f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    double mean = CalcMean(v,a,b);
129f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    double stdv = CalcStdv(v,a,b);
130f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
131f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    double cutA = mean - stdv*3;
132f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    double cutB = mean + stdv*3;
133f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
134f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    while((a < b) && (v[a] < cutA)) a++;
135f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    while((b > a) && (v[b] > cutB)) b--;
136f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  }
137f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
138f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  std::vector<double> v2;
139f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
140f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  v2.insert(v2.begin(),v.begin()+a,v.begin()+b+1);
141f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
142f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  v.swap(v2);
143f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com}
144f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
145f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com//-----------------------------------------------------------------------------
146f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com// We really want the rdtsc() calls to bracket the function call as tightly
147f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com// as possible, but that's hard to do portably. We'll try and get as close as
148f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com// possible by marking the function as NEVER_INLINE (to keep the optimizer from
149f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com// moving it) and marking the timing variables as "volatile register".
150f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
151f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.comNEVER_INLINE int64_t timehash ( pfHash hash, const void * key, int len, int seed )
152f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com{
153f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  volatile register int64_t begin,end;
154f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
155f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  uint32_t temp[16];
156f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
157f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  begin = rdtsc();
158f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
159f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  hash(key,len,seed,temp);
160f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
161f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  end = rdtsc();
162f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
163f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  return end-begin;
164f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com}
165f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
166f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com//-----------------------------------------------------------------------------
167f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
168f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.comdouble SpeedTest ( pfHash hash, uint32_t seed, const int trials, const int blocksize, const int align )
169f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com{
170f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  Rand r(seed);
171f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
172f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  uint8_t * buf = new uint8_t[blocksize + 512];
173f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
174f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  uint64_t t1 = reinterpret_cast<uint64_t>(buf);
175f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
176f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  t1 = (t1 + 255) & BIG_CONSTANT(0xFFFFFFFFFFFFFF00);
177f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  t1 += align;
178f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
179f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  uint8_t * block = reinterpret_cast<uint8_t*>(t1);
180f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
181f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  r.rand_p(block,blocksize);
182f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
183f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  //----------
184f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
185f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  std::vector<double> times;
186f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  times.reserve(trials);
187f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
188f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  for(int itrial = 0; itrial < trials; itrial++)
189f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  {
190f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    r.rand_p(block,blocksize);
191f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
192f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    double t = (double)timehash(hash,block,blocksize,itrial);
193f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
194f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    if(t > 0) times.push_back(t);
195f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  }
196f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
197f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  //----------
198f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
199f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  std::sort(times.begin(),times.end());
200f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
201f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  FilterOutliers(times);
202f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
203f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  delete [] buf;
204f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
205f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  return CalcMean(times);
206f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com}
207f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
208f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com//-----------------------------------------------------------------------------
209f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com// 256k blocks seem to give the best results.
210f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
211f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.comvoid BulkSpeedTest ( pfHash hash, uint32_t seed )
212f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com{
213f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  const int trials = 2999;
214f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  const int blocksize = 256 * 1024;
215f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
216f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  printf("Bulk speed test - %d-byte keys\n",blocksize);
217f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
218f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  for(int align = 0; align < 8; align++)
219f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  {
220f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    double cycles = SpeedTest(hash,seed,trials,blocksize,align);
221f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
222f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    double bestbpc = double(blocksize)/cycles;
223f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
224f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    double bestbps = (bestbpc * 3000000000.0 / 1048576.0);
225f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com    printf("Alignment %2d - %6.3f bytes/cycle - %7.2f MiB/sec @ 3 ghz\n",align,bestbpc,bestbps);
226f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  }
227f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com}
228f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
229f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com//-----------------------------------------------------------------------------
230f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
231f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.comvoid TinySpeedTest ( pfHash hash, int hashsize, int keysize, uint32_t seed, bool verbose, double & /*outCycles*/ )
232f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com{
233f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  const int trials = 999999;
234f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
235f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  if(verbose) printf("Small key speed test - %4d-byte keys - ",keysize);
236f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
237f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  double cycles = SpeedTest(hash,seed,trials,keysize,0);
238f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
239f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com  printf("%8.2f cycles/hash\n",cycles);
240f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com}
241f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com
242f3b789787b93945c974e2cc517b7dc352b28354etanjent@gmail.com//-----------------------------------------------------------------------------
243