-
Notifications
You must be signed in to change notification settings - Fork 764
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
Optimise parsing incoming payload #683
Conversation
|
There's an error when running
You probably need a type cast there. |
@stanley-cheung brilliant, thanks for your time on this! Do you think you guys could make a release any time soon which would include this fix? |
@travikk Actually there are some test breakage after incorporating this change - I am still trying to figure out what's wrong (the tests were internal so it wasn't discovered where the kokoro tests were run for this PR). So there are still some work to do here. Will keep you posted. |
Some partial findings on the test failure:
So actually I am not sure what the solution here should be. The previous solution works because |
One potential is to change the |
Yeah I was thinking about doing this, because then you could just pass the |
Slight bummer: we are implementing this |
In any case, I will probably have to revert this and figure out a different solution all together. Sorry about that. |
I see. So changing the |
That involves submitting a change to the google closure library itself, which has another separate process and hurdles. Not impossible, but I will have to pursue this from the inside :) |
Thanks, I appreciate the effort! |
@stanley-cheung any update on this that you can report? Perhaps we should create an issue out of this PR since the work isn't done yet? |
The type signature on StreamParser.parse is basically a lie, and I'd rather not change it further (though we can if necessary). Doing so would break all downstream implementations. That said, what is the problem with widening the parameter type in your GrpcWebStreamParser? It's allowed to widen a parameter type in a subclass (parameter types are contravariant, so this is actually narrowing the type of the function). The only concern would be if you're calling the parse() method using a reference typed as StreamParser instead of typed as your concrete subclass. But it looks like that's not what's happening here. @stanley-cheung have you tried simply widening the parameter to see if it breaks anything on your end? |
To this end, I raised another PR @stanley-cheung: #734 |
It seems redundant to copy the whole
byteSource
before parsing it.In our case, with
format: binary
and the payload size of 50mb this creates a lot of overhead. With our tests, that slice causes extra ~10s of processing time for a 50mb payload.I’m keen to hear your opinions about this change.