-
Notifications
You must be signed in to change notification settings - Fork 703
Open
Description
There is a major drop in performance when upgrading from Node 20 to Node 21/22+
Running the code below on Node 20:
SSH Connection: 2.579s
SFTP Session: 923.811ms
Directory Listing: 1.232s
Running the exact same code on Node 21/22/23:
SSH Connection: 3.304s
SFTP Session: 1.986s
Directory Listing: 2.625s
Creating an SFTP session and doing a readdir
are over 2x slower. This adds up when doing several readdir
over large directories.
const { Client } = require('ssh2');
const conn = new Client();
console.time('SSH Connection');
conn
.on('ready', () => {
console.timeEnd('SSH Connection');
console.time('SFTP Session');
conn.sftp(function (err, sftp) {
if (err) throw err;
console.timeEnd('SFTP Session');
console.time('Directory Listing');
sftp.readdir('/', function (err, list) {
if (err) throw err;
console.timeEnd('Directory Listing');
//console.log(list);
conn.end();
});
});
})
.connect({
host: 'remotehost',
port: 22,
username: 'demo',
password: 'password',
});
Metadata
Metadata
Assignees
Labels
No labels