-
Notifications
You must be signed in to change notification settings - Fork 93
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
LGTM pass by value #41
Comments
I'm looking the sample and we effectively copy each time the route_params_t, we can probably consider to pass it as const reference, or rvalue reference if it's created only for this function, no ? 88bytes seem's a lot. If it's was only a little |
It's just an example and the form: [](auto req, auto param) {...} was used just to make the example more compact and readable. You can safely change the code that way: [](const auto & req, const auto & params) {...} In fact, somewhere deep inside RESTinio code like that is used for calling a request handler: request_handle_t request{...};
...
router::router_params_t params{...};
...
// Calling a request_handler.
auto user_request_handler = find_handler(request, params);
if(user_request_handler)
user_request_handler(handle, params); So if your lambda (or functional object) accept arguments by const references instead there won't be any additional copies. |
But the req is a shared_ptr already no ? |
Thank's for the information, I was just following the readme without asking myself |
Yes. But RESTinio has to have a copy of req inside until request handler works. |
Can i consider: http_router->http_get("/api/v1/getprice", [this](auto&&... params)
{
return this->price_rest_callbook.get_price(std::forward<decltype(params)>(params)...);
}); |
You can try. I didn't try that way myself. |
Work's like a charm thank's for your patience and help. |
@Milerius |
@eao197 I enjoy and i hope you will ask for adding restinio to: https://www.techempower.com/benchmarks/ I'm looking for it. |
We no longer play such marketing games. They take too much time and don't bring money, but we have to pay bills. So it is better to spend our time and our resources to do something more useful like adding new features to RESTinio or help users with their issues. |
@eao197 Ok we use your framework at @KomodoPlatform https://github.com/KomodoPlatform We use a different library for We will let you know when the project is finish and in production ! (it's open source free project) |
And the project that is using restinio: https://github.com/KomodoPlatform/antara-makerbot |
Yes. RESTinio is a server-side only library.
Thank! |
Can I ask you to change a sentence in your "Acknowledgments" section? RESTinio is the result of teamwork, and Nicolai Grodzitski is the author of the significant part of RESTinio. So it is better to specify "StiffStream company" instead of just eao197. |
Of course ! (done) |
It seems that the usage of http_router->http_get("/api/v1/getprice",
std::bind(&your_callbook_class::get_price, &price_rest_callbook, _1, _2); where |
Hello i followed the example from the markdown for creating a request, but now i got this warning from LGTM security services:
Can we pass the router as const reference, or it's always as copy (like your example)
The text was updated successfully, but these errors were encountered: