- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have tried to use tbb::parallel_invoke to parallelize two functions. I have the next functins:
bool isValidDate(string order) int checkOrder(string order)
isValidDate check that the order date is correct and checkOrder check the format of the order.
Actually, I execute these functions sequentially, firstly I check the date and then the format. Now, I want to execute both functions in parallel, for this, I use parallel_invoke as follows:
tbb::parallel_invoke ( [&]{isValidDate(order);}, [&]{checkOrder(order);} );
This code execute correctly, but is slower than the secquential code. I don´t urdenstand why this is so.
Anybody could say me the reason or some way to parallelize the functions well?
Thank you so much!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi carlos,
It seems that in your case these functions take so little time to execute so that it is not justified to execute them in parallel because overheads involved exceed the payload inside these functions.
Please consider do more work in this functions like call them passing several orders to process.
Regards, Aleksei

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page