Summary:ASTERISK-06921: [patch] some little G.711 optimizations
Reporter:Denis Smirnov (mithraen)Labels:
Date Opened:2006-05-08 10:51:56Date Closed:2006-05-20 08:38:18
Versions:Frequency of
Environment:Attachments:( 0) g711.2006-05-20.patch
( 1) while-vs-for-test.tar.gz
Description:This patch change for( i=0; i < xxx; i++) to while ( i-- ), because second is faster on x86.

x86 processors has decremt operator which set flag zero/non zero, that can be tested.

I upload patch, and small demo for change in asm code with this optimization
Comments:By: Tilghman Lesher (tilghman) 2006-05-08 11:52:04

Is this also faster on the other architectures that we target, such as PowerPC?

By: Denis Smirnov (mithraen) 2006-05-09 08:59:58

Identical or faster.

If this architecture has "decrement and compare to zero" command (x86 hasn't decrement _without_ compare to zero), it would be faster. If not -- it would decrement and compare, like with for.

If you have access to PowerPC, please, try to run makefile in while-vs-for-test.tar.gz, and see or send me resulting asm code. I hasn't powerpc cross compiler.

By: Denis Smirnov (mithraen) 2006-05-16 11:44:01

What about this patch?

By: Russell Bryant (russell) 2006-05-19 22:20:42

Mithraen, did you mean to post a new patch when you made that last bug note?

By: Jeffrey C. Ollie (jcollie) 2006-05-19 22:30:49

What would really be interesting would be to use liboil for some of these cpu-intensve inner loops:


By: Russell Bryant (russell) 2006-05-19 22:38:41

1) Why did you change BUFFER_SAMPLES in codec_a_mu.c?

2) Could you please change the format of while( x-- ) to be while (x--).  That will better match the coding guidelines.

By: Denis Smirnov (mithraen) 2006-05-20 08:22:54

Patch updated with without buffer lenght change and with while( x-- ) -> while(x--) change.

About liboil -- yes, this is interesting, but only if using of this considered as standart in asterisk development.

And I think, that better is writing some simple inline functions, that can be use liboil _or_ intel IPP lib.

By: Russell Bryant (russell) 2006-05-20 08:38:17

added to the trunk in revision 29018, thanks!