Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0-31 Byte Random Length Benchmark #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,17 @@ void SelfTest(bool verbose) {

//----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// 0-31 Bytes Random Length Benchmark
void RandomLengthBenchmark( pfHash hash){
const unsigned maxlen=32; char temp[maxlen]={}; uint64_t out[16], sum=0; volatile int64_t begin, end;
begin = timer_start();
for(uint64_t i=0; i<0x1000000; i++){ hash(temp, sum&(maxlen-1), i, out); sum+=*out; }
end = timer_end();
printf("\n0-31 Bytes Random Length Benchmark:\t%0.3f cycles/op\n\n", (double)(end - begin) / 0x1000000);
fflush(NULL);
}

template < typename hashtype >
void test ( hashfunc<hashtype> hash, HashInfo* info )
{
Expand Down Expand Up @@ -506,6 +517,9 @@ void test ( hashfunc<hashtype> hash, HashInfo* info )
printf("Average %6.3f cycles/hash\n",sum);
printf("\n");
fflush(NULL);

RandomLengthBenchmark(info->hash);

} else {
// known slow hashes (> 500), cycle/hash
const struct { pfHash h; double cycles; } speeds[] =
Expand Down