[opus] [RFC PATCH v1 1/2] Optimize repeated calls to opus_select_arch

Viswanath Puttagunta viswanath.puttagunta at linaro.org
Tue Jan 20 11:29:44 PST 2015

On 20 January 2015 at 13:05, Timothy B. Terriberry <tterribe at xiph.org> wrote:
> Viswanath Puttagunta wrote:
>> Instead, just optimize the opus_select_arch() such that only
>> the first call to it takes more time, but subsequent calls to
>> it are much faster.
> This has been suggested before, but it is a bad idea. The patch posted below
> is not thread-safe or even re-entrant. You can argue that the results should
> always be the same, so it won't matter, but this is quite hard to prove
> given the actual freedom a compiler has [1], and the races will get reported
> as errors by automated race detection tools (such as we use on Firefox),
> making the lives harder of everyone who has to deal with that.
> Fixing this requires introducing dependencies on threading libraries, which
> are platform-specific (and may not even be available on some platforms) and
> will make you lose performance.
> So really I think the better solution is to modify the function signatures,
> even if it looks like more typing.
Thanks for the reference. I will type away in my RFCv2 :)

> [1] http://hboehm.info/boehm-hotpar11.pdf

More information about the opus mailing list