-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Reuse frame state arrays #5230
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
Reuse frame state arrays #5230
Conversation
| */ | ||
| ol.View.prototype.getHints = function() { | ||
| return this.hints_.slice(); | ||
| ol.View.prototype.getHints = function(opt_hints) { |
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'm not opposed to this. But do you see any problem with just returning this.hints_?
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.
Not sure about this; frameState.viewHints is updated in (at least) the animation functions
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 agree we can't reuse the same hints array everywhere. Though I think it is a pity that view hints are specific to a frame instead of a view.
If I ever get around to changing how animation works (so view properties are properly animated and we could finally have a "side-by-side" example that looks nice), then I think we won't need the extra code here.
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.
Thanks for the reminder, #5234
|
This looks like a good idea to me. I didn't check where else I'm also curious to learn if you are profiling to help identify places where garbage collection can be reduced. Or if you are just identifying optimization opportunities like this by looking through the code. |
It was very manual; I've added breakpoints in ol.size.buffer = function(size, buffer, opt_size) {
...
};I've added a conditional breakpoint if |
|
Thanks for the extra detail @fredj. This looks good to merge. |
|
Thanks for the review |
Reuse the extent and viewHints arrays from the previous frameState to reduce the number of temporary array