[FFmpeg-devel] PIC and YASM

Michael Niedermayer michaelni
Tue Nov 10 13:54:26 CET 2009


On Mon, Nov 09, 2009 at 04:26:41PM -0800, Frank Barchard wrote:
> On Mon, Nov 9, 2009 at 10:45 AM, Michael Niedermayer <michaelni at gmx.at>wrote:
> 
> > On Mon, Nov 09, 2009 at 10:12:12AM -0800, Frank Barchard wrote:
> > [...]
> > > An upside is that code can load faster, since there are no relocs,
> >
> > just curious, do you have a benchmark about this?
> >
> 
> Sorry, no.. someone else evaluated that.  Best I can do is tell you the
> current performance of loading ffmpeg on Vista
> [9644] DLL loadtime  1.21 ms, avcodec-52.dll
> [9644] DLL loadtime  0.33 ms, avformat-52.dll
> [9644] DLL loadtime  0.05 ms, avutil-50.dll

thats the time it takes to load them i assume not the difference that
PIC makes


> 
> >
> > > and take
> > > less memory by sharing dll's.
> >
> > and do you have some numbers about this?
> >
> 260k per tab in Chromium

thats also likely not the difference use of the pic flags make


> 
> 
> > PIC code is inherently larger and more complex, it does require
> > additional indirection tables, ...
> > thats a cost everyone who uses it, has to pay.
> >
> Is that for global / static variables that you write to?  For read only
> data, you can use RIP.

see yourself:

-------
const int value[2]={5,4};

int func(long i){
        return value[i];
}
-------
gcc -O3 try.c -S -o try.s
-------
func:
        movl    value(,%rdi,4), %eax
        ret
-------
gcc -O3 -fpic try.c -S -o try.s
-------
func:
        movq    value at GOTPCREL(%rip), %rax
        movl    (%rax,%rdi,4), %eax
        ret


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091110/2884bb75/attachment.pgp>



More information about the ffmpeg-devel mailing list