Is there a lot of overhead with AfxBeginThread?

How much overhead exists when AfxBeginThread does this?

I have an embarrassing parallel project, and I want to run batches of 4-15 threads with AfxBeginThread, wait for each to finish naturally, compare the results, and then repeat two million times.

What bothers me is that each worker thread will do much less than a second job, maybe 1 / 50th of a second or less, and to be honest, I don’t know how many cycles the AfxBeginThread voodoo enters to register a new thread , configure it, enter it and exit it naturally when the function ends.

Any thoughts?

+4
source share
1 answer

As a general principle, you probably want to avoid starting and stopping threads all the time. Create workflows once, and then feed them data millions of times. Then you do not need to worry about the flows of creation and destruction (which is small, but not trivial).

+6
source

Source: https://habr.com/ru/post/1382813/


All Articles