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

Slow streams over network connection on windows share #56319

Open
nassau-t opened this issue Dec 19, 2024 · 0 comments
Open

Slow streams over network connection on windows share #56319

nassau-t opened this issue Dec 19, 2024 · 0 comments
Labels
stream Issues and PRs related to the stream subsystem.

Comments

@nassau-t
Copy link

nassau-t commented Dec 19, 2024

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

@jakecastelli jakecastelli added the stream Issues and PRs related to the stream subsystem. label Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

No branches or pull requests

2 participants