Jump to content
Sign in to follow this  
satyricon11

file compression question

Recommended Posts

If I tried to compress 1 byte of data with winzip what would be the end result?

1 byte. I'm pretty sure 1 byte is the smallest amount of data which can be written to disk. It would also take up 512bytes* on most HDDs because that single file would take an entire sector on the drive. So even though it's only 1 byte it will use up 512bytes on the physical disk.

 

*Some newer drives use 4KB (4096bytes) sectors.

Share this post


Link to post
Share on other sites

Actually, a 1 byte file, will not compress at all with winzip, as winzip stores uncompressed directory metadata (filenames, create time, permissions etc), so in fact, a zip file, is significantly larger, gzip is also larger, but not as much, as it only stores the file metadata, not extra stuff about directory layouts.

 

Filename: bytes

random.bin: 1

random.zip: 171

random.bin.gz: 32

 

zero.bin: 1

zero.zip: 167

zero.bin.gz: 30

 

Interesting note: if you can compress random data, it's not random enough :)

Share this post


Link to post
Share on other sites

there is, but not with the usual methods.

 

Think of it like secret code.

 

If your data contains 1,2,3,4,5,6,7,8,9

But we establish that we could substitute that whole string for the letter 'a', then its only 1/9th its size.

 

You could literally write a quick compression program so that an ENTIRE file could be represented as 'a', though, the DE-compression program would end up being the same size as the original file, because all it knows is "When I see 'a' write, 'this file'"

 

So yeah; smaller than a byte is a nybble, and lost of stuff is that small.

 

For example, read the description of these, and see what can be done with tiny ammounts of space :)

" VIC-20 and a 1541 disk drive. Note that there are only 5120 bytes and 1024 nybbles of RAM available, and the total disk size of the demo is a mere 16 KB."

Edited by Master_Scythe

Share this post


Link to post
Share on other sites

Theoretically, you could compress it smaller if you had a bunch of files you were compressing into a single archive, rather than that single file.

Share this post


Link to post
Share on other sites

Yep, because then you have a lot of 'raw code' to substitute, as opposed to a 1byte file where you have a very limited ammount :)

 

Where that turning point would be, though, would depend on the type of data and how much of it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×