[FFmpeg-devel] [RFC] Disable compile-time tablegen for cbrt if total cycle count < 200000

Michael Niedermayer michael at niedermayer.cc
Mon Jan 4 00:44:49 CET 2016

On Mon, Jan 04, 2016 at 12:21:40AM +0100, Michael Niedermayer wrote:
> On Mon, Jan 04, 2016 at 12:07:15AM +0100, Michael Niedermayer wrote:
> > On Fri, Jan 01, 2016 at 08:07:39AM -0800, Ganesh Ajjanagadde wrote:
> > > Hi all,
> > > 
> > > Motivated by a remark by Ronald:
> > > https://ffmpeg.org/pipermail/ffmpeg-devel/2016-January/186200.html,
> > > this is a request for comment on disabling compile time tablegen for
> > > cbrt if the total cycle count < 200000. Note that cbrt tables are only
> > > used in aacdec.
> > 
> > Its very hard to state a hard number as the threshold, this is quite
> > subjective
> > and different viewpoints would lead to different results
> > 
> > but lets try anyway
> > for the hardcoded table case more data needs to be read from disk
> > ATM this is about 2mb for all tables
> > 
> > for dynamic tables the used tables need to be generated
> > theres a difference in binary size (table size vs code to generate it),
> > that translates into a cost value (bytes * cycles_per_byte)
> > 
> > and the dynamic init needs some time to build the table, thats
> > conveniently already in cycles
> > 
> > (above ignores alot, like HDDs, SDDs disk cache have different speed
> >  hardcoded tables can be shared between processes but then rarely would
> >  a process use all tables while the OS might end up loading all anyway
> >  also we assume a load from cache while a OS might actually map tables
> >  from the disk cache directly)
> > 
> > now if the dynamic init is faster than loading the table from
> > the disk cache then dynamic init is likely the better choice
> > 
> > using cat into /dev/null i get about 2bytes per cycle
> to make this more complex
> if the whole binary is read on init then all tables would need to be
> loaded while for a use case of repeated execution of ffmpeg only
> the tables needed for a single file would need to be build
> (the repeated execution is where the init time matters most)

if one assumes that hardcoded tables are always loaded and only one
set of tables is generated then the question would be how often
does a table need to be generated
for example if table foobar needs to be generated for 100% of the
files then the cost of 2bytes per cycle vs cycles to build it from
above would apply
while OTOH if a table is only generated for 1% of the files
then it would be 2bytes per cycle vs. X cycles to generate it * 0.01


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 1
"Used only once"    - "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160104/15d4faf5/attachment.sig>

More information about the ffmpeg-devel mailing list