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

is it worth re-implementing this client with protobuf.js? #655

Open
chadi-kazan opened this issue Feb 18, 2020 · 8 comments
Open

is it worth re-implementing this client with protobuf.js? #655

chadi-kazan opened this issue Feb 18, 2020 · 8 comments

Comments

@chadi-kazan
Copy link

instead of google-protobuf? I am seeing 1 in 10 requests suffering a considerable lag. Looking at protobuf.js, they seem to claim their implementation is more efficient than google-protobuf. the library however seems quite old so it's not clear if this still stands. is it worth re-implementing this client with protobuf.js?

@johanbrandhorst
Copy link
Contributor

I think it'd make sense to make it an option - but I think this might be the wrong repo? I think these changes would have to be made in https://github.com/improbable-eng/ts-protoc-gen. At the moment it expects to be generated into the same folder as the js_out output. I imagine it should be possible to add a variable that means it could assume to be used together with protobuf.js. What do you think?

@chadi-kazan
Copy link
Author

I just wanted to test replacing the google-protobuf encoding and decoding with the protobufjs implementation. I managed to hack a POC. correct me if am wrong, but there would be no real difference in performance if we use the javascript objects generated by protobufjs instead of those generated by google-protobuf, right?
the performance difference as, i understood, lies in the encodig /decoding process.

@johanbrandhorst
Copy link
Contributor

I think that's right, but we must obviously remain compatible with both (for backwards compatibility) if we're adding this.

@chadi-kazan
Copy link
Author

I see. and agree. that said, would you have an idea where this lag could be coming from?

@johanbrandhorst
Copy link
Contributor

Nope - the frontend isn't really my area of expertise. Maybe do some profiling?

@fatfatson
Copy link

I want to have the ability of deserializeJson, but google-protobuf doesn't supply
so I'm interested in the protobuf.js version working with grpc-web.

@bluskript
Copy link

bluskript commented Jan 18, 2021

image
Currently the biggest part of our bundle is the google-protobuf library.
protobuf.js is 73.2Kb, google-protobuf.js is 229.5Kb.
It would be very useful if there was a way to use protobuf.js as an alternative.

@markin-io
Copy link

It would also make sense to do so because google-protobuf does not comply with unsafe-eval CSP, which makes it not possible to use out of the box in Web Extensions.

See: protocolbuffers/protobuf-javascript#25

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

5 participants