Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Compression

From: brett:codeconscious at: 27-Jun-2001 14:55

Hi Louis,
> It might be the second possibility. If I type the following at the
command
> prompt it works: > > write/binary %data.r decompress read/binary %/a/data.r
Ok this is the real problem - you use the same name for the uncompressed version as you do for the compressed version. Logically it works but in practise it is not a good idea. This is risky. You are increasing your risks of losing data. Why? Because devices (computers) sometimes fail. It might be a floppy (quite prone to failure) or your hard disk or a power shortage - whatever. When you are transforming your data so significantly as in the compression/decompression steps you are taking, you should write the transformed data to a new file. While on risks, the Rebol User guide warns about storing data using compression - if a couple of bits are changed by some stray cosmic radiation or whatever - you're more likely to be unable to recover them.
> If compress/decompress is used for every write, then performance will be > affected.
There's always a trade-off. With compression you are exchanging processing power for disk space. You need to choose what is more important to you taking into consideration the amount of information you are dealing with, the patterns of your use, the equipment you will use it on, etc...
> I just want to compress the data so that more will fit on a > floppy disk for backup purposes.
Fair enough. So just do the compression using another script when you want to perform a backup. If you are using a different name there will be no confusion. Floppies are small on price and offer similar protection for backing up data. Multiple backups of the same data would be a good idea. Depends on how critical your data is. Oh and don't forget to check that you can read a file from a floppy once you have written to it - always good to test your backups actually are backups and not placebos.
> I don't want the database compressed > during ordinary usage. How do I get around this problem?
The solution is simply to leave data.r uncompressed and use it as normal. Then as mentioned above compress the information it contains when you need to and save to a different name and possibly a different location. Brett