Squinch
Squinch is a compact streaming LZ77-style compressor optimized for highly repetitive data, ASCII, and UTF-8 text. It prioritizes concise, readable code, a tiny decompressor binary, low memory usage, and a straightforward file format over speed and maximum compression efficiency. The format is simple enough that a decompressor can even be implemented as a shell script using AWK.
Although gzip and LZ4 generally offer much better compression ratios and higher performance, Squinch can occasionally even outperform LZ4 depending on the settings used and the characteristics of the input data. This places it in the same general performance ballpark, albeit near the lower end, while requiring significantly less code, memory, and offering much smaller binaries.
Squinch also provides standalone compressor and decompressor implementations, each contained in a single C source file. These files can be added directly to other projects (optionally together with their headers) and compiled with any standards-compliant C compiler for all platforms for which a suitable compiler exists.
The compressor is also highly configurable through parameters that control its memory usage and CPU requirements. This allows users to balance resource consumption, compression time, and compression ratio according to their needs. The selected compression settings also determine the minimum requirements of the decompressor, which can likewise be configured to trade decompression speed for lower memory usage.
!!! Warning !!!
Until the release version reaches 1.0, the Squinch format is not stable. Streams use format version 1 in their header, but the format may still change between pre-1.0 releases. An archive created by a pre-1.0 release may therefore not be decompressible by the final release.
You can already use Squinch in your own projects, but its output is not suitable for long-term archives.
Project goals
- Keep the file format very simple.
- Keep the decompressor easy to implement in almost any programming language, including a shell script using AWK.
- Keep the code small and easy to read.
- Keep memory usage low while still making it configurable, so more memory can improve compression when that tradeoff is worthwhile.
- Keep the compressor and decompressor easy to add to another C project as ordinary source files.
Non-goals
- Be the strongest compressor.
- Be the fastest compressor.
When should I use Squinch?
Generally, you should not. There are much better compressors for modern projects, such as LZ4, gzip, bzip2, and xz. They provide better compression and often even faster decompression.
Why use Squinch at all?
If you work in a very storage-constrained environment, such as one with a small EEPROM, or a memory-constrained environment, such as a tiny embedded system, Squinch may be an option. In particular, you can tailor the decompressor's memory usage to almost any available system.
Squinch may also be useful if you need to port it to an obscure language, or want to re-implement it natively in a scripting language or virtual machine. It has very little, simple code to port, and the storage format is simple enough that you can easily implement a decompressor yourself.
Building from source
Run make to build squinch and unsquinch. Run make test to run the correctness suite.
Documentation
- Usage explains the command-line programs.
- Download lists the available binary releases.
- Development links developer documentation and tests.
Licensing
Squinch is free software released under the GNU Affero General Public License, version 3 or any later version (AGPL-3.0-or-later). The complete license text is in LICENSE-AGPL-3.0-or-later.
The following Squinch files are additionally released under the Apache License, version 2.0 (Apache-2.0), at your option:
The complete Apache license text is in LICENSE-Apache-2.0. These files may therefore be used under either the AGPL-3.0-or-later or the Apache-2.0 terms. The remaining Squinch files are licensed only under the AGPL-3.0-or-later.
The project-specific license map is in LICENSE.
The source code vendored under util/benchmark/lib is third-party code and is not relicensed by Squinch. The benchmark uses LZ4 and gzip, which retain their own licenses. See util/benchmark/lib/README.md.
My other projects
See my other projects.