[FFmpeg-devel] [RFC] AES init

Michael Niedermayer michaelni
Sun May 13 21:39:02 CEST 2007


On Sun, May 13, 2007 at 08:02:37PM +0200, Reimar D?ffinger wrote:
> Hello,
> On Sun, May 13, 2007 at 07:38:15PM +0200, Luca Barbato wrote:
> > Rich Felker wrote:
> > > Personally I'm against runtime initialization. All the data is
> > > constant! Include these tables as static arrays in the text/rodata
> > > segment and they'll use less memory and the race condition goes away
> > > permanently without hackish solutions like this.
> > 
> > The only problem is that it would consume memory needlessly, still it is
> > less complicated than the other solution proposed.
> ?? It will consume extra disk space, but not any more memory. Actually
> it will consume _less_ in some ways, since it can be swapped out to the
> original binary instead of using swap space if you really need all that
> memory.

it would need less virtual memory and less swap space but not less
physical memory

now IMHO virtual memory and swap space is not that much of a limited resource
that this would matter much, i mean it starts mattering if we would be
speaking of 100mb or so but here the object file size matters very much too
and the object may be fragmented on the disk while the swap partition is not
so loading the stuff from the object file will be slower

now if there are multiple instances of the code in memeory the rodata-table
variant has the big advantage of being easily shareable though the init
based code is theoretically also shareable its just tricky for the kernel


if the init code is similarely large or larger than the table then putting
the table in rodata is the obvious winner

if OTOH the init code is significantly smaller than the table then things
start drifting into the philosohical "whats more important" area
i don think putting 500mb into rodata and thus into the object is the
correct thing to do
i wish there where a inited-rodata which would be shareable between
processes and the kernel would just throw the data away if it needed
the memory and call the init code again if it needed the table again ...

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070513/d62a2f99/attachment.pgp>

More information about the ffmpeg-devel mailing list