Re: [Boost-bugs] [Boost C++ Libraries] #7422: Provide a condition variable with zero-overhead performance penality

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7422: Provide a condition variable with zero-overhead performance penality
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-12-14 10:02:35

#7422: Provide a condition variable with zero-overhead performance penality
  Reporter: maxim.yegorushkin@… | Owner: viboes
      Type: Feature Requests | Status: assigned
 Milestone: To Be Determined | Component: thread
   Version: Boost 1.51.0 | Severity: Regression
Resolution: | Keywords: condition_variable

Comment (by Maxim Yegorushkin <maxim.yegorushkin@…>):

 Replying to [comment:19 viboes]:
> I have run the no-interruptions benchmark (modified to compile on MacOS)
 using clang-3.2 without setting any special conditions changing 3
> * CONSUMER_MAX: from 20 to 10
> * test iterations: from 3 to 100
> * shared_data iteration : from 100000 to 10000.
> here are the results:
> {{{
> consumers,(std-boost)/std,std,boost
> 1,-5.063747,44009306,46237826
> 2,-1.764249,72169561,73442812
> 3,5.327530,94552244,89514945
> 4,0.767002,121827567,120893147
> 5,1.826591,141517038,138932100
> 6,0.471998,171223003,170414834
> 7,-0.937626,187902198,189664017
> 8,-0.840567,220015472,221864850
> 9,-3.291703,236884513,244682047
> 10,0.397024,272506100,271424186
> }}}

 This is quite different from what I observe.

 What kind of implementation of std primitives does clang use? Is it from
 gnu standard C++ library (the same as g++)?

 Also the difference may be due to a different process scheduler on Mac OS.

> I'm sure that the setting of your special condition would change these

 You are quite right. Running the benchmark with CPU frequency scaling
 turned on (the default) makes the results more noisy (increases variance).
 Running it with the standard scheduler priority also increases variance
 and make boost primitives perform even worse compared to std ones.

> From these results, I don't see a loss of 5% of Boost respect to std.
 Please could you run the benchmark with these parameters ans your

 I ran it with your settings (10 consumers max, 100 repetitions, 10000
 iterations) and it didn't change the normalized numbers for me.

> * running the benchmark with real-time priority FIFO 99,
> * disable CPU frequency scaling to prevent the CPU from shifting gears
 while benchmarking
> How do you do this?

 To run it with maximum real-time priority I invoked the benchmark as `chrt
 -f 99 <benchmark>`. Depending on your OS settings you may need special
 privileges to be able to use real-time priorities.

 On Linux CPU frequency scaling can be disabled by doing:
 for f in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
     echo performance > $f
 Not sure how it is done on Mac OS.

Ticket URL: <>
Boost C++ Libraries <>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:11 UTC