Skip to content

Commit

Permalink
perf: Increase copy() buffer to 32k
Browse files Browse the repository at this point in the history
This will improve the threshold benchmark. Using 32k because that's what
Go uses, but we should explore the value in the future.
https://github.com/golang/go/blob/a0d6420d8be2ae7164797051ec74fa2a2df466a1/src/io/io.go#L391
  • Loading branch information
ry committed Oct 12, 2018
1 parent 298d755 commit c9f95d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion js/io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export interface ReadWriteSeeker extends Reader, Writer, Seeker {}
// https://golang.org/pkg/io/#Copy
export async function copy(dst: Writer, src: Reader): Promise<number> {
let n = 0;
const b = new Uint8Array(1024);
const b = new Uint8Array(32*1024);
let gotEOF = false;
while (gotEOF === false) {
const result = await src.read(b);
Expand Down

0 comments on commit c9f95d5

Please sign in to comment.