| Science Forum Index » Compression Forum » gzputs performance problem... |
|
Page 1 of 1 |
|
| Author |
Message |
| liorlew... |
Posted: Mon Sep 14, 2009 10:42 am |
|
|
|
Guest
|
Hello,
I am writing a program that reads a string line from the data base.
and then write it in gzformat to disk.
the flow is
gzopen(...);
loop
read line from DB
gzputs(...)
end loop
gzclose()
the problem is that the program is probably using direct write and my
performance is 800% worse that when writing a regular file.
what am I doing wrong? is there a possibility to do a setvbuf on a
gzFile? basically, I need to be able to open the output using gzip, I
will appreciate any other alternative.
Thank you,
Lior |
|
|
| Back to top |
|
|
|
| Mark Adler... |
Posted: Mon Sep 14, 2009 10:32 pm |
|
|
|
Guest
|
On 2009-09-14 13:42:24 -0700, liorlew <liorlew at (no spam) gmail.com> said:
[quote:830413d908]the problem is that the program is probably using direct write and my
performance is 800% worse that when writing a regular file.
[/quote:830413d908]
I don't know what you mean by "direct write", but in any case you
should expect that compressing will be slower than not compressing.
When doing the gzopen(), you can add a compression level to select the
right compromise between compression and execution time for your
application. The default level is 6. For example you can gzopen(...,
"wb3") to select compression level 3 for higher speed at the cost of
some compression.
Mark |
|
|
| Back to top |
|
|
|
|