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

Memoize annotation style color. #339

Merged
merged 1 commit into from
Feb 21, 2019
Merged

Conversation

manthey
Copy link
Member

@manthey manthey commented Feb 20, 2019

A significant fraction of the time preparing annotation with many elements is spent calling tinycolor. Since most elements will share colors, memoizing this speeds it up substantially.

A significant fraction of the time preparing annotation with many
elements is spent calling tinycolor.  Since most elements will share
colors, memoizing this speeds it up substantially.
@manthey
Copy link
Member Author

manthey commented Feb 20, 2019

When displaying a large number of rectangular annotations, this change plus OpenGeoscience/geojs#979 and OpenGeoscience/geojs#980 substantially speed up the initial render.

Specifically, when showing the maximum number of rectangles (currently 25000 / 4), after the json call for the data finished, a Chrome browser was spending around 2.4 seconds preparing to display the annotations. With these three changes, it takes only around 0.6 seconds.

@manthey manthey requested a review from jbeezley February 20, 2019 21:18
@manthey manthey merged commit ab066cd into master Feb 21, 2019
@manthey manthey deleted the memoize-annotation-style-color branch February 21, 2019 14:14
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.

2 participants