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

Decoding slower than JSON.parse() #114

Open
espatial opened this issue Jun 17, 2020 · 2 comments
Open

Decoding slower than JSON.parse() #114

espatial opened this issue Jun 17, 2020 · 2 comments
Labels

Comments

@espatial
Copy link

I am loading a geojson file of full US Zipcodes over an ajax request, before I was using plain json, I now change it to use geobuf. So I replace the JSON.parse() by a geobuf.decode().

The document says it should be faster:

even faster than native JSON parse/stringify.

However now it is actualy 2 seconds slower.

var req = new XMLHttpRequest();
req.responseType = "arraybuffer";
req.addEventListener("load", function () {

	//var featureCollection = JSON.parse(this.responseText); // Took arround 4s
	var featureCollection = geobuf.decode(new Pbf(this.response)); // takes arround 6s
	//...
});
req.open("GET", url);
req.send();

Am I doing something wrong or is there any way to improve it?

@espatial espatial reopened this Jun 17, 2020
@mourner
Copy link
Member

mourner commented Jun 17, 2020

Interesting! Unfortunately there's no way for me to tell why it might be slower without a live test case I can reproduce.

@segheysens
Copy link

@espatial do you have a reproducible example I could dig into?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants