Subject: Re: Openssh vs ssh2

Re: Openssh vs ssh2

From: Simon Josefsson <>
Date: Tue, 19 Oct 2010 14:55:17 +0200

may nothing <> writes:

> Hi all,
> I finally finished my little sftp-client taht uses the libssh2 library and made
> some tests.
> I downloaded a 260MB testfile from a remote machine via openssh's sftp clienet
> and my own binary. The linux "time" command measured the time spend.
> For openssh's sftp client: 3:48
> For libssh2 sftp client: 5:56
> (For curl sftp client: 12:44)
> Question: Why is the libssh2 sftp so much slower (or is it an issue of my code)
> that the openssh one ?

Could you run your tool under callgrind and analyze the output to see
what functions your client is spending its time? If it is something
silly, we should be able to spot it easily. However, if it is buffer
size related (which I suspect) the answer is probably just because
OpenSSH is better designed.

Running under callgrind is relatively easily, just run your program like

time valgrind --tool=callgrind --quiet ./foo

which will generate a callgrind.out.* file. Gzip it and post it to the
list, or use kcachegrind on it to see what the top-10 functions are.

Received on 2010-10-19