阅读背景:

如何最好地增强我的程序以利用strcmp的时序优化?

来源:互联网 

I'm currently working on a project that relies on the timing optimization of strcmp. For example, given two strings a1, a2 where a1=a2 and two strings b1, b2 where b1=/=b2 we know that strcmp (a1,a2) will take longer to complete than strcmp(b1,b2) in theory since strcmp finishes once it realizes that one byte in the first string is unequal to the corresponding byte in the second which implies that strcmp will take the longest to complete when the two strings are equal since it needs to iterate over the entire length. My project is currently timing the performance of strcmp using various strings and its success is dependent on one call of strcmp being quicker than another call even if one byte in the two strings being compared is off.I'm currently working on a project that relies




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: