Home

Awesome

Efficient Compression Tool

Efficient Compression Tool (or ECT) is a C++ file optimizer.
It supports PNG, JPEG, GZIP and ZIP files.

Performance (v0.9.2)

All tests were run on macOS 12.5 using an Intel i7-7700HQ and clang.
File: enwik8, 100,000,000 bytes, compressed into gzip format

CompressorFile SizeTime
ECT -136,493,2573.5s
gzip -936,475,8115.8s
zopfli -i135,102,3711m 30.2s
ECT -235,019,44014.8s
zopfli -i534,983,7572m 12.0s
ECT -335,014,54316.2s
zopfli -i1534,966,0783m 59.9s
ECT -434,963,58119.8s
zopfli -i3034,961,4536m 30.6s
ECT -534,942,79625.1s
ECT -634,943,94341.9s
ECT -734,942,34859.7s
ECT -834,941,1252m 25.6s
ECT -934,937,7813m 17.9s

Building

To build ECT, you need to recursively clone it, just downloading isn’t enough, i. e. git clone --recursive https://github.com/fhanau/Efficient-Compression-Tool.git
You may also need to install nasm if it is not available already.

Command line

ECT is built with cmake

mkdir build
cd build
cmake ../src
make

In addition, you can add the following arguments to the cmake call to turn various features on and off:

With Xcode

You can use cmake to generate an Xcode project. Just add -G Xcode to the end of the cmake command:

mkdir build
cd build
cmake ../src -G Xcode
make

You will run into a slight issue in that Xcode doesn't know how to compile some of the asm files within mozjpeg. To fix this, locate your copy of nasm (/usr/local/bin/nasm in the example) navigate to the Build Rules of the simd target, and add a custom rule to process source files matching *.asm with the following script:

/usr/local/bin/nasm "-I${PROJECT_DIR}/mozjpeg" -DMACHO -D__x86_64__ "-I${PROJECT_DIR}/mozjpeg/simd/nasm/" "-I${PROJECT_DIR}/mozjpeg/simd/x86_64/" -f macho64 -o "${BUILT_PRODUCTS_DIR}/x86_64/${INPUT_FILE_BASE}.o" "${INPUT_FILE_PATH}"

and set $(BUILT_PRODUCTS_DIR)/x86_64/${INPUT_FILE_BASE}.o as the output files.

If you are using Xcode for development and do not need maximum speed, you can also disable the asm files by adding -DWITH_SIMD=OFF to the cmake.