New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speed up local action execution #3017
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall good catch! Please see the comment about keep_alive
future<Result> f = make_ready_future( | ||
get_remote_result_type::call(std::move(result))); | ||
|
||
return keep_alive(std::move(f), id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to keep the id alive here. The future is already done and the handler will be called immediately having no effect at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this to maintain semantic compatibility with the old code. A user may rely on the id being kept alive until the value was extracted from the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, in which scenario would that be the case? Originally, the keep alive was there to ensure that the component stays alive until the result is delivered. In the case where have a local synchronous invocation, this holds true. In addition, the handler is called immediately with the id_type refcounter being decremented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I concur.
action_type::execute_function( | ||
addr.address_, addr.type_, std::forward<Ts>(vs)...); | ||
|
||
return keep_alive(make_ready_future(), id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here regarding keep_alive
addr.address_, addr.type_, std::forward<Ts>(vs)...); | ||
|
||
return keep_alive(std::move(f), id); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that!
0ce15e2
to
fac4e4b
Compare
@sithhell Your comment shave been addressed. |
- this patch significantly speeds up local action execution (both, direct and non-direct) by avoiding to construct a (remote) promise but instead directly scheduling the function bound to the action as a local thread, while using a simple (local-only) future.
fac4e4b
to
4377a55
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks!
direct and non-direct) by avoiding to construct a (remote) promise
but instead directly scheduling the function bound to the action
as a local thread, while using a simple (local-only) future.
the function