Skip to content

Slow streams over network connection on windows share #56319

@nassau-t

Description

@nassau-t

Version

v23.4.0

Platform

Microsoft Windows NT 10.0.19045.0 x64

Subsystem

streams

What steps will reproduce the bug?

const fs = require('node:fs');
const readline = require('node:readline');

const sourcePath = "G:\\file.txt"; // 700 MB text file with 547 characters long lines on a windows share
const targetPath = "G:\\file.txt.copy";

const myInterface = readline.createInterface({
  input: fs.createReadStream(sourcePath).setEncoding('binary')
});
fs.closeSync(fs.openSync(targetPath, 'w'));
const output = fs.createWriteStream(targetPath);
output.setDefaultEncoding('utf-8');

myInterface.on('line', function (line) {
  output.write(line);
});

myInterface.on('close', function (line) {
  output.end();
  console.log(`Saved!`); // In node, at about 3 or 4 MB over network it shows this "Saved!", but continues copying?!
});

How often does it reproduce? Is there a required condition?

every time

What is the expected behavior? Why is that the expected behavior?

Faster stream copy

What do you see instead?

On 1 GB ethernet connection over windows share, with node v23.4.0 -> 513 seconds . It seemed a lot to me, so I tried with Bun
Same connection and share, with bun 1.1.39 -> 13 seconds.
So node is about 39x (slower)

And it's also strange that at about 3 or 4 MB file.copy, node shows the "Saved!" message but continues copying.

Additional information

On local disk, node is a bit faster than bun.
So it seems that problem is over network connection

Metadata

Metadata

Assignees

No one assigned

    Labels

    streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions