Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

zlib and deque
Hello people...first post here.

I have written a c++ program that uses in-memory compression.
Currently, I handle dynamic memory allocation using a custom container
class that essentially performs memory operations for arrays.  To use
zlib, I need to have all the data in memory *plus* reserved memory to
hold the zlib output (either compression or uncompression).  This is
typically not a problem...however, when the amount of data to be
compressed or uncompressed approaches a significant fraction of the
physical RAM, the zlib operations take an enormous performance hit due
to the overhead of using swap files.

Part of the problem is that (at least the way I'm using it), zlib
requires twice (well actuall a hair more than twice) the memory it
actually needs when compressing (source + dest).  I was thinking that
if I could put the data that needs compressing into a deque and then
compress into another deque there would likely be substantial
performance increase, and the need to use swap files wouldn't come
into play until much larger amounts of memory were needed.

I envision compressing data by pop_front from the source deque, and
push_back to destination deque.

This would free up the source deque's memory as it is no-longer
needed, and make it available to destination deque.

Currently, I'm using zlib in a very simple way...I've created member
functions of my container class compressIt() and decompressIt() that
call the zlib functions and then assign the destination buffer to the
container itself.  Since I'm sending the zlib functions pointer and
data-length info, I don't see a way to do the same using deque while
removing data from the deque as it's used.

Can anyone point me in the right direction??

Thanks

Joe

Report this thread to moderator Post Follow-up to this message
Old Post
J. Campbell
10-04-04 08:55 PM


Re: zlib and deque
"J. Campbell" <mango_maniac@yahoo.com> wrote in message
news:b97c86e1.0410040708.5c3a9a7b@posting.google.com...
> Hello people...first post here.
>
> I have written a c++ program that uses in-memory compression.
> Currently, I handle dynamic memory allocation using a custom container
> class that essentially performs memory operations for arrays.  To use
> zlib, I need to have all the data in memory *plus* reserved memory to
> hold the zlib output (either compression or uncompression).  This is
> typically not a problem...however, when the amount of data to be
> compressed or uncompressed approaches a significant fraction of the
> physical RAM, the zlib operations take an enormous performance hit due
> to the overhead of using swap files.

The input and output buffers for zlib can be any size, as small as one byte.
You don't need to read all of your data before you start
compressing/uncompressing it.

-- Matt Mahoney



Report this thread to moderator Post Follow-up to this message
Old Post
Matt Mahoney
10-04-04 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Compression archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:53 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.