[Mplayer-cvslog] CVS: main/DOCS/tech TODO,1.9,1.10

Nick Kurshev nickols_k at mail.ru
Wed Dec 12 17:02:19 CET 2001


Hello, Michael!

On Mon, 10 Dec 2001 22:50:02 +0100 you wrote:

> Hi
> 
> On Monday 10 December 2001 18:56, Nick Kurshev wrote:
> [...]
> > > try it yourself (attached benchmark compiled with -O4)
> > > the output for my p3 is
> > > 51052k cycles needed for 10000000 calls through if/else
> > > 140573k cycles needed for 10000000 calls through function pointers
> >
> > And for witch memcpy?
> > fast_memcpy_MMX2 or fast_memcpy_MMX?
> none its just a comparision between if/else vs function pointers
> 
> > Anyway - it's only in theoretical test but in practic processor won't
> > to save conditional branch-table for this branch and probably will
> > predict false branch.
> it will allways use the same memcpy routine so it should be near 100% 
> predictable unless u xchange the cpu while its running ;)
> 
> > I know only that manuals always suggested to replace conditional jumps
> > with direct code ;)
> yes but that isnt possible here
> they allso suggest to avoid function pointers
> 
Did you read K7 manual?
What about:
JMP near mreg16/32 (indirect)    DirectPath
JMP near mem16/32 (indirect)     DirectPath

> >
> > If you will accept my idea - I have solutution for self-modification code
> > without changning logic of mplayer of each your TEMPLATE set.
> selfmodifying code is possible here yes but u save perhaps 2 cpu cycles while 
> a single memory access needs 50 or so, i doubt that it is worth it ... and it 
> would only affect the runtime cpu detection enabled binaries, but if u want 
> to implement it than do it ... iam allways happy if someone can make the code 
> faster :)
> btw some comilers might inline the if&else and memcpy function into the 
> calling function ... using selfmodifieing code will cause a speedloss here 
> because it cant be inlined anymore
> 
My tests shows me that on Duron:
direct call takes 4 clocks
indirect call takes 5 clocks
(these clocks include measuring of loop)
So there is only 20% of difference that is too few against memcpy process.

> [...]
> 
> Michael
> _______________________________________________
> Mplayer-cvslog mailing list
> Mplayer-cvslog at mplayerhq.hu
> http://mplayerhq.hu/mailman/listinfo/mplayer-cvslog
> 


Best regards! Nick



More information about the MPlayer-cvslog mailing list