开发者

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

开发者 https://www.devze.com 2023-02-19 16:45 出处:网络
Is there a way to benchmark crypto libraries so t开发者_如何转开发hat the results are hardware independent? No. Many libraries will make use of various CPU facilities in order to speed up their algori

Is there a way to benchmark crypto libraries so t开发者_如何转开发hat the results are hardware independent?


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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消