I am writing a server application that takes data from several sources at once and stores it in its internal database (currently std::set ).
I just looked at Microsoft ConcRT PPL data structures and wondered how their performance is compared using the fine-grained mutex on std::unordered_set . For example, there is a big performance difference between two pieces of code:
void StdWithMutex( void ) { std::ofstream outFile( "Test.tmp" ); std::lock_guard<std::mutex> lockGuard( m_mutex );
and
void ConcRT( void ) { std::ofstream outFile( "Test.tmp" );
Moveover, I often have to print data in order, so I use std::set as opposed to std::unordered_set , so if there is an advantage in using concurrency::concurrent_unordered_set , the potential performance gain comes close to the cost of reordering the data every time it need to print?
source share