Daniel Gartmann
Daniel Gartmann

Reputation: 13038

Is there a way to benchmark crypto libraries so that the results are hardware independent?

Is there a way to benchmark crypto libraries so that the results are hardware independent?

Upvotes: 0

Views: 259

Answers (3)

sergico
sergico

Reputation: 2621

To benchmark algorithms on x86 machine in a frequency independent way we use to count CPU cycles rather than time. Not sure if ARM suport such feature, if so, you can have solve your problem using some conditional code like:

uint64_t get_cycles()
{
#ifdef _INTEL_X86
// return CPU cycle count with x86 specific code
// read tim stamp counter instruction rdtsc() for instance
#endif
#ifdef _ARM
// return CPU cycle count with ARM specific code
#endif
}

uint64_t start, stop, tot_cycles;
start = get_cycles();
// code to benchmark
stop = get_cycles()
tot_cycles = stop - start;

Hope this might help.

Upvotes: 0

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799150

No. Many libraries will make use of various CPU facilities in order to speed up their algorithms, thereby making hardware-independent benchmarks impossible.

Upvotes: 3

Daniel Böhmer
Daniel Böhmer

Reputation: 15411

Use different hardware environments and calculate averages. I guess you'll also find useful information which lib suits your needs best on the net without doing benchmarks yourself.

Upvotes: 0

Related Questions