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

setData() is blocking #1956

Closed
mcwhittemore opened this issue Jan 20, 2016 · 3 comments
Closed

setData() is blocking #1956

mcwhittemore opened this issue Jan 20, 2016 · 3 comments

Comments

@mcwhittemore
Copy link
Contributor

I'm currently doing some perf work on gl-draw and found that the call to setData for a geojson source takes ~6milli on average when calling it with an object. I haven't checked what happens when you call it with a url.

Because this api can take a url, I assumed it was an async function that did its hard work on its own time. Should setData be async? If so, I can dive in and find out why its not. If not, I can work around this in gl-draw, I just wanted to check.

Also, the length of time this function takes from a synchronous point of view is all over the place even if the geojson object is more or less the same size.

@jfirebaugh
Copy link
Contributor

It is async, in that it transfers data to a web worker for processing. But passing a lot of data to a web worker is inherently expensive, which is why we recommend using a URL.

This has been discussed previously, see #1391, #1504, #1762, #1505, etc.

@tikhonbelousko
Copy link

@jfirebaugh can I use url which will be sending GeoBuf? Or mapbox only expects GeoJSON? Can I gzip it at least?

@mourner
Copy link
Member

mourner commented Mar 18, 2016

@dazzz gzipped GeoJSON works fine (with the right headers). We may add support for geobuf in future though, as a side effect of #1504.

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

No branches or pull requests

4 participants