Comments (2)
Hey!
I'd say the function is too small (plus is allocating and deallocating the vector each time is called). In cases like this one, it may be counter productive to use the thread. This is because the overhead that the thread pool adds (to keep track of the queue, callbacks, etc) is too big in comparison with the time required to execute the function, which is really really small.
If you want to execute the same light function multiple times, you can probably build a less generic thread pool that is optimized for that. Nevertheless, for such simple math operations, the overhead may still be too high.
This article may be of your interest: https://en.wikipedia.org/wiki/Amdahl%27s_law
Hope this helps!
from thread-pool.
Thank you so much
from thread-pool.
Related Issues (17)
- Is it redundant with two locks? HOT 2
- Synchronization on shutdown. HOT 5
- Is there a way to have a member method as the executed function? HOT 2
- Author of another thread pool says mtrebi's thread pool fails tests HOT 12
- Building problem - cmake configure HOT 2
- Would you tell me why you use notify_one instead of notify_all here?
- How to wait for all tasks to finish?
- The output file doesn't output anything on compiling on Windows with MinGW-w64
- Not threadsafe
- 应用层,类的非静态函数不能使用,目前仅静态函数可用 HOT 3
- Bug report: When sub-task are performed quickly, the results are inaccurate HOT 4
- Avoid additional copy optimization recommendations
- memory leaks
- duplicated mutex? HOT 1
- How to use C++ member function in thread pool HOT 5
- Heap allocation issues HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from thread-pool.