Compression
Compression
Hi Lutz,
Its on my wishlist for some time now but how do you think about a small and
simple compression/decompression implementation in newlisp? (like a small lha implementation) someehing like: (compress str) and (decompress str).
Regards, Norman.
Its on my wishlist for some time now but how do you think about a small and
simple compression/decompression implementation in newlisp? (like a small lha implementation) someehing like: (compress str) and (decompress str).
Regards, Norman.
-- (define? (Cornflakes))
There was a thread about importing gzip:
http://www.alh.net/newlisp/phpbb/viewto ... light=zlib
And for windows (hpwNLUtility):
http://www.alh.net/newlisp/phpbb/viewto ... light=zlib
http://www.alh.net/newlisp/phpbb/viewto ... light=zlib
And for windows (hpwNLUtility):
http://www.alh.net/newlisp/phpbb/viewto ... light=zlib
Hans-Peter
Your right about the thread ;-) Though I never came to the Zlib because
it simple too big for a simple compression. I also had a look at miniLha lib
but that one still is 16 Kb..
(I dont care what compression as long as it compresses :-)
How about a simple LZW imlant?
Though Im hoping of a C implemented fast simple compression routine
inside newlisp. the CRC was also done by Lutz and its small and fast.
Perhpas Lutz can do some X-mass features ;-)
Regards, Norman
it simple too big for a simple compression. I also had a look at miniLha lib
but that one still is 16 Kb..
(I dont care what compression as long as it compresses :-)
How about a simple LZW imlant?
Though Im hoping of a C implemented fast simple compression routine
inside newlisp. the CRC was also done by Lutz and its small and fast.
Perhpas Lutz can do some X-mass features ;-)
Regards, Norman
-- (define? (Cornflakes))
So its finaly Done, we have compression, done by Pjot!
You can download it from his site at -> http://www.turtle.dds.nl/newlisp/lzw.lsp
PS: its not the worldrecord on speed, thought it is compession! ;-)
You can download it from his site at -> http://www.turtle.dds.nl/newlisp/lzw.lsp
PS: its not the worldrecord on speed, thought it is compession! ;-)
-- (define? (Cornflakes))
The LZW compression context has been optimized and is ready for consumption. Compared to the first implementation, the compression speed has improved with 25%, while the decompression speed has improved dramatically with about 80%.
LZW is a technique which normally is used to compress GIF and TIFF files. It is very suitable to compress text. Files up to 500k compress reasonably fast with this context.
http://www.turtle.dds.nl/newlisp/lzw.lsp
If somebody has suggestions to increase the compression speed even more, please let me know. :-)
Enjoy,
Peter
LZW is a technique which normally is used to compress GIF and TIFF files. It is very suitable to compress text. Files up to 500k compress reasonably fast with this context.
http://www.turtle.dds.nl/newlisp/lzw.lsp
If somebody has suggestions to increase the compression speed even more, please let me know. :-)
Enjoy,
Peter
The LZW compression has been optimized even more. The average compression speed compared to the former situation is 5x faster.
On my P4 2Ghz an e-text of 500kB can be compressed in 4 seconds now. If your machine is faster then it will take even less time.
The latest version is here:
http://www.turtle.dds.nl/newlisp/lzw.lsp
To test, just copy some file into the same directory as 'LZW.lsp', with the name "dump.txt", and run 'LZW.lsp'. The compression also works with binary files.
Regards
Peter
On my P4 2Ghz an e-text of 500kB can be compressed in 4 seconds now. If your machine is faster then it will take even less time.
The latest version is here:
http://www.turtle.dds.nl/newlisp/lzw.lsp
To test, just copy some file into the same directory as 'LZW.lsp', with the name "dump.txt", and run 'LZW.lsp'. The compression also works with binary files.
Regards
Peter
On an AMD 64 3200+
filesize: 4614809 (pure text, dictionary file)
Starting compression, please wait... Time spent (msecs): 17020
Starting decompression, please wait... Time spent (msecs): 30283
1/4 of 4614809 (1153703 bytes or the same file) ->
Starting compression, please wait... Time spent (msecs): 4282
Starting decompression, please wait... Time spent (msecs): 7589
They both come pretty close to a 4:1 ...
Norman.
filesize: 4614809 (pure text, dictionary file)
Starting compression, please wait... Time spent (msecs): 17020
Starting decompression, please wait... Time spent (msecs): 30283
1/4 of 4614809 (1153703 bytes or the same file) ->
Starting compression, please wait... Time spent (msecs): 4282
Starting decompression, please wait... Time spent (msecs): 7589
They both come pretty close to a 4:1 ...
Norman.
-- (define? (Cornflakes))
Self-extracting possibilities were added.
http://www.turtle.dds.nl/newlisp/lzw.lsp
Just call
Peter
http://www.turtle.dds.nl/newlisp/lzw.lsp
Just call
and it will create a self-extracting ".lzx" file. If this ".lzx" file is executed by newlisp, it will be decompressed. In Unix/Linux it is also possible to run it directly, like "./myfile.ext.lzx". In Windows you need to execute "newlisp myfile.ext.lzx" to decompress.(LZW:lzx "myfile.ext")
Peter