Skip to main content

Can I save space GZip Compressing a string before storage?

By July 25, 2012Tech

Ever wonder if it would be more efficient to save compressed versions of your strings for storage in databases etc? I wanted to check several variations on this recently, so came up with the following simple test. Just enter the string in the box below, select the compression level, and the answer will be shown. The php function ‘gzcompress’ is used.

String to compress

Compression level, 0 = none, 9 = best (takes longer though)


The results of last text where as follows

The string was originally characters in length. The new compressed string is characters in length. This is a saving of percent. The conversion took microseconds. Compression level was used.

Your original string

Your compressed string (base64 encoded)

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.