Data Compression
Data compression is the process of encoding information using fewer bits than the original representation to save storage or bandwidth.
Algorithms: 1. Lossless: LZ4, Zstd, Gzip, Brotli. 2. Lossy: H.264/HEVC, AV1, MP3, JPEG. Metrics: Compression Ratio, Encoding Time, Decoding Speed. Use Cases: Web performance (HTTP headers), Video streaming, File archiving (ZIP), Large-scale data storage.
graph LR
Center["Data Compression"]:::main
Rel_boolean["boolean"]:::related -.-> Center
click Rel_boolean "/terms/boolean"
Rel_data_modeling["data-modeling"]:::related -.-> Center
click Rel_data_modeling "/terms/data-modeling"
Rel_data_structure["data-structure"]:::related -.-> Center
click Rel_data_structure "/terms/data-structure"
classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
linkStyle default stroke:#4b5563,stroke-width:2px;
🧒 Explain Like I'm 5
Imagine you have a shopping list that says: 'Apple, Apple, Apple, Apple, Orange'. A compressed version would be '4 Apples, 1 Orange'. You said the same thing but used fewer words (or 'bits'). If you can get the original list back perfectly, it's 'Lossless'. If you just said 'Fruits' and forgot exactly which ones they were but got the general idea, that's like 'Lossy' compression.
🤓 Expert Deep Dive
Technically, lossless compression often leverages 'Lempel-Ziv' (LZ) algorithms (like LZ77 used in DEFLATE/PNG) and 'Huffman Coding' (assigning shorter codes to more frequent symbols). In contrast, lossy compression—like for JPEG—uses frequency-domain transformations such as the 'Discrete Cosine Transform' (DCT) followed by 'Quantization', where high-frequency details the human eye can't see are discarded. Modern data systems use 'Zstandard' (Zstd) developed by Facebook, which combines dictionaries and finite state entropy to provide extreme speeds. In the context of blockchain, 'Call-data Compression' is critical for Layer 2 Rollups, as it reduces the amount of expensive data that must be posted to Ethereum, directly lowering transaction fees for users.