Search
Primary links
Please donate to libfreevec to ensure its continuing development! Donations are done via Paypal.
memset()
markos — Tue, 29/01/2008 - 17:48
Description
According to the man page, memset() function fills the first n bytes of the memory area pointed to by s with the constant byte c. It returns a pointer to the memory area s.
Along with memcpy(), memset() is probably the #2 function that gets specific arch optimizations. Currently it is optimised for x86 and x86_64, and also for most PowerPC variants. The glibc implementation fills 32-bit (or 64-bit depending on the arch) blocks where possible. In libfreevec we also do that, but as we already have stated, we also use modern SIMD units (AltiVec for PowerPC CPUs, and in the future SSE for x86 CPUs). This has the effect that for smaller sizes, the performance is the same but for larger sizes performance increases dramatically.
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
Not so many comments need to be made here, as it's quite obvious that the Athlon X2 is a very strong performer due to its faster memory bus, but the G5 seems to beat it when using AltiVec by a close margin, even with its slower memory bus (533Mhz vs 800Mhz). The nice surprise is the MPC8610's performance which is very close to the much faster CPUs (G5/Athlon) and given its lower frequency (1.3Ghz), this makes the CPU a great contender. Last, we also note that libfreevec beats libmotovec on the G4 by a large margin.