Closed KonghaYao closed 5 months ago
I think in a good benchmark, you can distinguish:
In your current benchmark, you have a negligible task, and you mix starting up new threads with actually executing the task. Since reversing a short string takes 0ms and starting a worker takes something like 50ms, I expect you're mostly measuring starting up 4 or 8 workers right now (depending on how many CPU's you have). I don't think that is your intention?
The result is below
My source code is here. https://github.com/KonghaYao/workerpool/tree/benchmark/benchmark Every library need to run 40 tasks. The task is to have a function in the worker that takes a string as input and returns it reversed to main thread.
But I am not sure if it is rigorous enough, can anyone help me? 😊