Avoid QueryPerformanceFrequency() call in tick_count::interval_t()
Every time the tbb::tick_count::interval_t(double sec) constructor is called, the ticks_per_second() method gets called.
Inside the ticks_per_second() method, the QueryPerformanceFrequency() function gets called (on Windows targets).
All those calls are inefficient, as stated in https://www.threadingbuildingblocks.org/docs/help/reference/timing/tick_count_cls/tick_count_interva...
A simple way to handle his would be to modify the ticks_per_second() method like this, so that the QueryPerformanceFrequency() call is done only the first time :
static LARGE_INTEGER qpfreq;
int rval = (qpfreq.QuadPart == 0) ? QueryPerformanceFrequency(&qpfreq) : TRUE;
instead of :
int rval = QueryPerformanceFrequency(&qpfreq);
This way, each time we call condition_variable.wait_for(interval_t(0.1)) for example, we don't get any penalty during interval_t construction.
Do you think it would be possible to integrate this tiny modification inside the TBB ?
I know it looks like a detail, but it would be useful I think.
Thanks a lot.