Subject: Re: Disabling compression by API?

Re: Disabling compression by API?

From: Aris Adamantiadis <>
Date: Fri, 08 Oct 2010 22:17:48 +0200

Le 08/10/10 22:02, Daniel Stenberg a écrit :
> Well, on a modern PC that sends a small packet compressed, is the very
> tiny microsecond or whatever the compression function call takes really
> a factor at all?
Probably. but compressing certainly is as costly as encryption. And
can't be speeded up with hardware or threading tricks (like aes128-ctr
which can be pre-computed by a thread on another cpu/core).

aris_at_darkforce:~$ dd if=/dev/urandom of=file count=1000000
1000000+0 enregistrements lus
1000000+0 enregistrements écrits
512000000 octets (512 MB) copiés, 73,3125 s, 7,0 MB/s
aris_at_darkforce:~$ time dd if=file of=/dev/null
real 0m0.525s
aris_at_darkforce:~$ time gzip -c file > /dev/null

real 0m20.975s
user 0m20.740s
sys 0m0.130s
model name : AMD Phenom(tm) II X4 945 Processor

I'm sorry I don't have statistics for aes encryption.

> I'm not saying that it does any good, I just question that it actually
> is noticable. I guess if you send a large pre-compressed stream it will
> be measureable at least.
Here the throughput I got from my gzip (on a quite worst case, I ack)
is around 200mbps (512000000 * 8 /20 /(1024*1024)). It's less than the
speed I'd expect to have using SSH on high speed link, and it doesn't
even count time spent on encryption and basic protocol handling.
>> My opinion is that compression is useful when transferring files of
>> unknown type, or mainly text files. Some content with high entropy
>> (compressed files, video, ...) are slow to compress and decompress ;
>> If there is an API call do enable/disable it (libssh does), everybody
>> should be happy.
> Right, but the question right now is mostly: what is the default?
> Out of curiosity, what does libssh default to?
It defaults to "none". If application designer thinks it's interesting
to have compression by default, it's easy to enable.
Also, it's a lot less of complicated code that is running in the lib
and makes the debugging really easier when some bug report comes in
(even if I don't remember having a bug report related to compression,
except maybe the feature request for

Received on 2010-10-08