I think you need to try something a little more heavy. All your doing is adding int
s together. The overhead of creating the threads, etc. will be greater. Try replacing int
with std::string
and running the following code and compare the output:
int main()
{
vector<string> in(100000);
auto t = std::chrono::high_resolution_clock::now();
accumulate(in.begin(), in.end(), string(), [](string s1, string s2){ return s1 += s2 + "a" + "b";});
auto t2 = std::chrono::high_resolution_clock::now();
cout << std::chrono::duration_cast<std::chrono::milliseconds>(t2 - t).count() << endl;
}