MAC with 16GB RAM and 2x8 cores - producer/consumer is SLOW; using all cores I get the worst result.
posted 6 years ago
Here is the scenario: I have 40 employees and each employee has a task to perform (task comes from DB). Each employee submit at the end a list of results.
I'm using producer-consumer here to do this so my code looks like this:
So, this code works just fine BUT...it's relatively slow.
I'm running this on a MAC with 16GB RAM and 2x8 cores!
When running this with nProcessors=2 I get the optimal result and yet it's slow.
nProcessors=1 completion is 1.14min
nProcessors=2 completion is 55 sec
nProcessors=8 completion is 4.52min
nProcessors=16 completion is 9.24min
I assume that the Task is 'heavy', ie it has a lot of data (list of items etc) and some emlp has 600 tasks.
1. How can I ensure that my assumption (Task is heavy) is the answer to this speed issue (how can I check if a Task=5mb of memory?!?! or the list of task is Xmb)
2. Can I improve this code to get better performance?