[FFmpeg-devel] [PATCH] Reduce usage of strcmp when setting default options

Michael Niedermayer michaelni
Mon Nov 2 22:37:58 CET 2009

On Mon, Nov 02, 2009 at 09:12:34PM +0100, Edward Hervey wrote:
> Hi all,
>  While doing some profiling, I noticed that av_opt_set_defaults2 would
> end up doing a rather big number of strcmp calls.
>  The problem was that av_opt_set_defaults2 would, for each AVOption:
>  * call av_set_* ... with the name of the option as the argument
>  * av_set_* would... search for the AVOption based on the name.
>  The following patch creates some variants of the existing av_set_*
> functions that take an AVOption directly instead of the name of an
> option.
>  The new functions are static and not exposed, if some people want them
> to be public, I can add that.

I do like your change in principle but not the API, its too complex.
I think an API like av_set_string3() that has a **AVOption argument
seems like a more natural solution, that is if that argument is non NULL
and points to a non NULL AVOption then the search could be skiped

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- 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/20091102/2c95eecd/attachment.pgp>

More information about the ffmpeg-devel mailing list