pabloem commented on code in PR #22137:
URL: https://github.com/apache/beam/pull/22137#discussion_r915314070
##########
sdks/typescript/src/apache_beam/coders/standard_coders.ts:
##########
@@ -123,9 +123,9 @@ export class DoubleCoder implements Coder<number> {
}
decode(reader: Reader, context: Context): number {
- const barr = new Uint8Array(reader.buf, reader.pos, 8);
- const dView = new DataView(barr.buffer);
- reader.float();
+ const barr = new Uint8Array(reader.buf);
+ const dView = new DataView(barr.buffer.slice(reader.pos, reader.pos + 8));
Review Comment:
this seems to add a new allocation plus copy (via `slice`) to the decode
function, right? what's the issue that this solves? Is there a way to solve
this without the extra copy?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]