strnlen()Submitted by markos on Tue, 01/29/2008 - 18:04.
Description According to the man page, the strlen() function returns the number of characters in the string pointed to by s, not including the terminating '\0' character, but at most maxlen. In doing this, strnlen() looks only at the first maxlen characters at s and never beyond s+maxlen. It returns strlen(s), if that is less than maxlen, or maxlen if there is no '\0' character among the first maxlen characters pointed to by s. Though strnlen() is quite common (maybe not as used as strlen() though), unfortunately it is not usually optimised for most architectures. libfreevec provides an AltiVec-optimised version. 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 The joy we got from the strlen(), is lost again... Though to be frank, if we measured glibc performance only, the results would not be so unpredictable. But then, we would only be measuring the performance of an under-optimised routine, and not the actual performance that a CPU can produce. When using AltiVec, a 7-year old CPU (the G4) manages (albeit using AltiVec) to reach the performance of a modern dual-core CPU with more than twice the frequency. Whatsmore, the MPC8610 beats all other CPUs, even the G5! The more we work with the MPC8610 the more we like it :D The results will be more fair once we complete the SSE port of libfreevec and we compare the results. SIMD
|
SIMDUser login |