[PATCH] Improved strlen for ARM, around 29% faster

Rich Felker dalias at aerifal.cx
Wed Oct 3 18:12:19 UTC 2012


On Wed, Oct 03, 2012 at 01:54:23PM -0400, Rich Felker wrote:
> On Sat, Sep 29, 2012 at 02:48:48AM +0200, Gabriel Gonzalez wrote:
> > This version for ARM improves performance mainly unrolling the loop for iterations 
> > and reducing the instructions need to look for the null character.
> > A deeper analysis of this can be found at http://www.gabrielgonzalezgarcia.com/2012/10/02/mystrlen-vs-android-bionics-strlen-on-arm-cpu/ 
> > where you can find some data which back up the performance improvement.
> > I have only tested it on a little endian CPU so the BIG ENDIAN chunk might need some testing
> 
> I suspect this code is still considerably slower than the good C
> implementation, which looks something like:

Never mind, looks like you're using the good algorithm. And gcc does a
rather bad job of optimizing it for ARM, so you should be able to beat
it easily. Cheers.

Rich


More information about the uClibc mailing list