-
Notifications
You must be signed in to change notification settings - Fork 49
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
Codegen: convert Arc<Box<T>> to Arc<T> #235
Conversation
ec8a6f6
to
d88f833
Compare
@wllenyj sry please wait a moment. Let me test locally if sync version works fine with this. |
@wllenyj Add the line of sync version |
Hi @wllenyj @Tim-Zhang What should I do else to move this forward? |
This commit changes the generated ttrpc server from Arc<Box<T>> to Arc<T>. This helps the type conversion and also avoids extra runtime cost caused by double pointer. Fixes containerd#234 Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
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.
It will simplify the code:
before:
let h = Box::new(HealthService {}) as Box<dyn health_ttrpc::Health + Send + Sync>;
let h = Arc::new(h);
let hservice = health_ttrpc::create_health(h);
after:
let hservice = health_ttrpc::create_health(Arc::new(HealthService {}));
it also will cut down heap allocations, thanks @Xynnn007
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #235 +/- ##
==========================================
- Coverage 24.97% 24.74% -0.23%
==========================================
Files 16 16
Lines 2651 2675 +24
==========================================
Hits 662 662
- Misses 1989 2013 +24 ☔ View full report in Codecov by Sentry. |
update for commit 1f2a26 Signed-off-by: Tim Zhang <tim@hyper.sh>
Cut the release for containerd#235. Signed-off-by: Tim Zhang <tim@hyper.sh>
Cut the release for containerd#235. Signed-off-by: Tim Zhang <tim@hyper.sh>
This commit changes the generated ttrpc server from Arc<Box> to Arc. This helps the type conversion and also avoids extra runtime cost caused by double pointer.
Fixes #234