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

Encapsulate SymbolBucket's unique requirements #3478

Merged
merged 2 commits into from
Oct 28, 2016
Merged

Conversation

jfirebaugh
Copy link
Contributor

SymbolBucket is in several ways the "odd bucket out":

  • It's the only bucket type that works with multiple program interfaces -- one for glyphs, one for icons, and one for collision boxes.
  • It's the only bucket type whose instances are reused to build buffers multiple times.

Previously, the Bucket base class was generalized such that it could support multiple program interfaces for any Bucket subtype, and re-create buffers at any time. However, this added complexity to all subtypes other than Symbol.

Now, SymbolBucket encapsulates its differences:

  • It uses ArrayGroup/BufferGroup directly, creating one for each of its three interfaces. In turn, the other bucket types, their corresponding layer rendering functions, and the Bucket base class, can all assume a single program interface.
  • It recreates these arrays when needed, while the Bucket base class creates them once, in the constructor.

@jfirebaugh
Copy link
Contributor Author

This is crashing the buffer benchmarks for some reason.

@jfirebaugh
Copy link
Contributor Author

I made a 🐛 . Fixed.

benchmark master 965a2f3 symbol-bucket f74e58c
map-load 144 ms 92 ms
style-load 118 ms 117 ms
buffer 1,053 ms 1,078 ms
fps 60 fps 60 fps
frame-duration 7 ms, 0% > 16ms 6.9 ms, 0% > 16ms
query-point 1.10 ms 1.14 ms
query-box 66.95 ms 67.50 ms
geojson-setdata-small 9 ms 8 ms
geojson-setdata-large 275 ms 278 ms

SymbolBucket is in several ways the "odd bucket out":

* It's the only bucket type that works with multiple program interfaces -- one for glyphs, one for icons, and one for collision boxes.
* It's the only bucket type whose instances are reused to build buffers multiple times.

Previously, the Bucket base class was generalized such that it could support multiple program interfaces for any Bucket subtype, and re-create buffers at any time. However, this added complexity to all subtypes other than Symbol.

Now, SymbolBucket encapsulates its differences:

* It uses ArrayGroup/BufferGroup directly, creating one for each of its three interfaces. In turn, the other bucket types, their corresponding layer rendering functions, and the Bucket base class, can all assume a single program interface.
* It recreates these arrays when needed, while the Bucket base class creates them once, in the constructor.
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