7 ms·
I’m not that comfortable with Xcode, but I just built two versions of this tool, one direct from GitHub, one (called lzfse2) that calls the Compression library
by Someone 10y ago
I’m not that comfortable with Xcode, but I just built two versions of this tool, one direct from GitHub, one (called lzfse2) that calls the Compression library on Mac OS X. Typical timings on my system are:
> time ./lzfse -encode -i webster -o webster.lzfse
real 0m0.945s
user 0m0.864s
sys 0m0.062s
> time ./lzfse2 -encode -i webster -o webster.lzfse2
real 0m0.803s
user 0m0.715s
sys 0m0.072s
> time ./lzfse -decode -i webster.lzfse -o /dev/null
real 0m0.133s
user 0m0.091s
sys 0m0.036s
> time ./lzfse2 -decode -i webster.lzfse2 -o /dev/null
real 0m0.083s
user 0m0.053s
sys 0m0.025s
So, the version that ships on Mac OS X seems to be faster (10% at encoding, 35% at decoding) than what this source and makefile produce. I don’t think that has to do with my way of building them, as I used the makefile (which uses -Os) to build the original tool, and any compiler flags will not have much effect on the one using the Mac OS X library.
Worryingly, the two versions also produce different files (12,209,496 bytes for the GitHub code, 12,234,159 bytes for the library on Mac OS X 10.11.5), but they can decompress each others files and produce the original file.
- eln1 10y agoThe difference is size probably come from suboptimalities which were repaired after open-sourcing: http://encode.ru/threads/2221-LZFSE-New-Apple-Data-Compression?p=48489&viewfull=1#post48489 http://encode.ru/threads/2221-LZFSE-New-Apple-Data-Compressi... The difference in speed is more surprising, it could come from using a different compiler - there can be really large differences.
- jibsen 10y agoTry compiling with a recent 64-bit GCC and adding `-mtune=native -flto` to the mix.
- espadrine 10y ago> Worryingly, the two versions also produce different files That is actually pretty common. I would guess the version you have in macOS is an older version. They may have tweaked the algorithm to deliver slightly better compression at the expense of speed, which is always the tradeoff in this field. On the other hand, I would not be surprised if they prepared special tweaks in their internal version to better support arm64. Strategically, Apple seems to believe that people will stick with building for their App Store if they are pushed to write non-cross-platform code. (Oddly enough, LZFSE/LZVN seems well-suited for file system compression on hard drives, but here again, Yann Collet wins with its LZ4's superior compression speeds, which impact write speeds.)