A Delphi zlib 1.2.3 implementation for fastest performances

A Delphi zlib 1.2.3 implementation for fastest(*) performances,
including targeted P6 code generation, 64bit alignment, source changes and optimizations
following Borland® C++ full standards adherence, and a Delphi added
low level copy memory function to speedup typical strings management.
Embed the newest zlib 1.2.3 objects into your programs without using external dlls,
take a look into the example seeing how to work with streams and strings.

Press here to download zlib 1.1.4 version 25737 direct downloads   

Press here to download zlib 1.2.3 version 22675 direct downloads   


Recompiled with latest Borland C++ 2006 SP2


use ZSendToBrowser to send compressed text to browsers http1.1 compliant, let make your website(s) four times light!
It's ideal to use with dinamic cgi or isapi programs, this is my real test benchmark:
send 100 strings of 32767bytes (a big size html doc length) -> 0.40 seconds on Celeron1100Mhz -> 0.26 seconds on Athlon1200Mhz

If you use ZSendToBrowser, first check the http1.1 header field "HTTP_ACCEPT_ENCODING: deflate" from client,
then, if it exist the browser can receive compressed deflate data: build the header response with the line inside "Content-Encoding: deflate"

use ZFastCompressString and ZFastDecompressString to work with strings: 300% faster than equivalent ZCompressStr...


ZFastCompressString and ZFastDecompressString are using movei32() for copying not aligned structures,
this mean that if you need to manage little strings (<~512bytes) this can guarantee a large speedup, else you have to replace movei32 with
the standard RTL move, that's more efficient with larger data

(*) tested on Celeron CPU: it's ~40% faster than native DLL distribution and Zlib Pascal version
B1(vs Pascal Zlib) B2(vs native DLL) Bench's results courtesy of Michael Haralabos and Ray Norrish

My home page :) Borland home page




The mostly common question: how to compress a big file and decompress it? Copy&paste ;-)

Btw. ZDecompressStream accept max 32KB buffer, for this cause you need use the wrapper over VCL TStream to decompress large files.