Skip to content
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

Cache the buffered extent value #3059

Merged
merged 1 commit into from Feb 3, 2015
Merged

Cache the buffered extent value #3059

merged 1 commit into from Feb 3, 2015

Conversation

fredj
Copy link
Member

@fredj fredj commented Dec 18, 2014

Assuming that the maxExtent and resolution property are immutable

fixes #3057

@fredj
Copy link
Member Author

fredj commented Feb 2, 2015

Thanks for any review

// invalid buffered max extent cache
this.bufferedMaxExtent_ = null;
this.maxLineWidth = Math.max(this.maxLineWidth, this.state_.lineWidth);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about not using Math.max and do this:

  if (this.state_.lineWidth > this.maxLineWidth) {
    this.maxLineWidth = this.state_.lineWidth;
    // invalidate buffered max extent cache
    this.bufferedMaxExtent_ = null;
  }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@elemoine
Copy link
Member

elemoine commented Feb 2, 2015

Shouldn't the same be done in the WebGL replay code?

Assuming that the maxExtent and resolution property are immutable
@fredj
Copy link
Member Author

fredj commented Feb 3, 2015

The WebGL replay code doesn't use a bufferedMaxExtent

@elemoine
Copy link
Member

elemoine commented Feb 3, 2015

The WebGL replay code doesn't use a bufferedMaxExtent

Right.

LGTM.

@fredj
Copy link
Member Author

fredj commented Feb 3, 2015

Thanks for the review

fredj added a commit that referenced this pull request Feb 3, 2015
Cache the buffered extent value
@fredj fredj merged commit 38c80e7 into openlayers:master Feb 3, 2015
@fredj fredj deleted the memory branch February 3, 2015 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ol.render.canvas.*#getBufferedMaxExtent optimization
3 participants