-
Notifications
You must be signed in to change notification settings - Fork 332
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
Caching routes #58
Caching routes #58
Conversation
Is it really a performance issue? |
It was one of the top classes spending time when we ran jprofiler in our project. When the project has many routes and a lot of linkTo calls in the view, this might spend some time. After this improvement, the router disappeared from jprofiler report and we beleive that improved about 5% in our response time (according to ab). It's not much, but is something, isn't? |
We could compute this map on the initialisation, when registering the routes. What do you think? |
controllerType = type; | ||
this.method = method; | ||
} | ||
|
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.
Hashcode and equals methods are too long. What you think to use Guava Objects or java.lang.Objects to compute hashCode and equals?
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 think that's fair, since it's a performance tuning :-)
The Class<?> type
and Method method
parameters are always the exact same reference? (given the same class and method...)?
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.
@csokol, java.lang.Objects have methods to compute hashCode similar with Eclipse generated. Java.util.Objects is a utility class, not lava.lang.Object (sorry for not explaining properly).
But we cannot dicover dynamic routes such as /users/{id}. How could we compute that map during initialisation? |
Since it's a map of Invocation => Route, there are no dynamic parameters =) |
Duh. Of course, sorry :-) I guess all I have to do is inject all controllers and implement Chico Sokol On Wed, Sep 11, 2013 at 8:58 PM, Lucas Cavalcanti
|
|
||
@Path("/myPath/{param}") | ||
public void pathWithParam(String param) { | ||
} |
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.
you're not using this method... throw it away :)
@lucascs, I've pushed some commits. I had to add a getter method to the Route interface, I couldn't find a better way to get the routes built and the controllers/methods during initialisation. Do you have I better solution? It's working in musicjungle, but I left a test broken (the one with the proxy). If you don't have better idea I can work on fixing this test... |
I've modified to call |
🚢 |
No description provided.