Compiling for single-threaded use (implicit threading support difference in 4.9.1 vs. 4.8.1)
Marc Glisse
marc.glisse@inria.fr
Wed Oct 15 11:40:00 GMT 2014
On Wed, 15 Oct 2014, Jonathan Wakely wrote:
> On 14 October 2014 18:29, Johan Alfredsson wrote:
>> As my application is single-threaded, I don't want to pay the
>> performance penalty of mutexes etc. Hence, my question is if it is
>> possible to explicitly request gcc to compile my application in
>> single-threaded mode.
>
> It should happen automatically, there's no way to request it because
> there should be no need.
Well, I would quite like a compilation flag
-fI-promise-not-to-use-threads, that would automatically turn atomics into
plain variables with regular operations, turn TLS into regular memory,
remove locks, etc, and perform all the optimizations this enables. It
isn't quite the same as a runtime test that only skips a few mutexes in
the library.
--
Marc Glisse
More information about the Gcc-help
mailing list