strlen()Submitted by markos on Tue, 01/29/2008 - 18:05.
Description According to the man page, the strlen() function calculates the length of the string s, not including the terminating '\0' character. It returns the number of characters in s. As we already said in strcpy(), strlen() is probably the #1 used string function. For that reason, along with memcpy()/memcmp(), it's one of the first optimised functions for every arch. Of course, libfreevec provides an AltiVec-optimised version. However, performance is lagging for some CPUs (the G5 in particular) in the libfreevec version, at least for the moment. Each CPU in detail: And for comparison here is the result of the same benchmark run on an Athlon X2 5000 (2.5Ghz), running 32-bit code: Results/Comments At last, for the first time, we found a string function that performs great on the Athlon X2! Finally someone took the effort to optimise this so common function for the i686 (the 32-bit subarch of most Intel/AMD CPUs, which we're benchmarking). There's not much to say, apart from the fact that the Athlon really beats everything except perhaps for big string sizes, where the MPC8610 wins using the libfreevec strlen(). Strangely, on the G5, glibc is faster than the libfreevec version, which is something we intend to examine further, along with the porting to 64-bit. Lastly, we have to commend the libmotovec version, which manages to get amazing performance out of AltiVec beating even the Athlon (and this on the plain G4@1Ghz), but which suffers from the same problem of performance drop after a certain string size, unfortunately. SIMD
|
SIMDUser login |