LZ4 VS squashfs-tools-ng

Compare LZ4 vs squashfs-tools-ng and see what are their differences.

LZ4

Extremely Fast Compression algorithm (by lz4)
Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
LZ4 squashfs-tools-ng
21 7
9,177 186
1.5% -
9.5 8.4
10 days ago 25 days ago
C C
GNU General Public License v3.0 or later GNU General Public License v3.0 or later
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

LZ4

Posts with mentions or reviews of LZ4. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-03-21.
  • Rsyncing 20TB locally
    2 projects | /r/zfs | 21 Mar 2023
    According to these https://github.com/lz4/lz4 values you need around ten (10) quite modern cores in parallel to accomplish around 8GB/s.
  • Cerbios Xbox Bios V2.2.0 BETA Released (1.0 - 1.6)
    2 projects | /r/originalxbox | 31 Dec 2022
  • zstd
    8 projects | news.ycombinator.com | 19 Dec 2022
    > The downside of lz4 is that it can’t be configured to run at higher & slower compression ratios.

    lz4 has some level of configurability? https://github.com/lz4/lz4/blob/v1.9.4/lib/lz4frame.h#L194

    There's also LZ4_HC.

  • I'm new to this
    2 projects | /r/androidroot | 28 Nov 2022
    Get your bootloader unlocked via Download mode and then obtain your stock firmware, preferably for your current region https://samfw.com (Download mode: CARRIER_CODE). Get the boot image from AP with 7zip, unpack from LZ4 with https://github.com/lz4/lz4/releases (drag and drop), patch with Magisk https://github.com/topjohnwu/magisk/releases/latest, grab the new image, name it "boot.img" and pack it into a .tar with 7zip and flash to AP with odin https://odindownload.com
  • An efficient image format for SDL
    4 projects | /r/gamedev | 28 Sep 2022
    After some investigations and experiments, I found out that it was the PNG compression (well, decompression I should say) that took a while. So I've made some experiments using the LZ4 compression library, which is focused on decompression speed, and it turned out to be an excellent solution!
  • Bzip3 – a better and stronger spiritual successor to bzip2
    4 projects | news.ycombinator.com | 10 May 2022
    If anyone just cares for speed instead of compression I’d recommend lz4 [1]. I only recently started using it. Its speed is almost comparable to memcpy.

    [1] https://github.com/lz4/lz4

  • I just took a random screenshot and made it look prettier. [ I don't know if this counts as fanart ]
    2 projects | /r/PixelGun | 20 Dec 2021
    E: Realtime compression (A good compression library like Zstandard can make a game less than half the size while taking a tiny amount of CPU power when loading stuff. I think thats a pretty worthwhile trade.) (ZSTD github) (LZ4 github)
  • What's the best way to compress strings?
    6 projects | /r/cpp | 29 Jul 2021
    lz4 for maximum decompression speed, for data that is often read but rarely written
  • How to become a tools/graphics/engine programmer
    2 projects | /r/gameenginedevs | 23 Apr 2021
    Getting lost in material models is tempting. But, at this point you are overdue for working on your own asset pipeline. glTF is great. But, you should learn how to do it yourself. The hardest part will be reading source asset files. The FBX SDK is painful. Assimp isn't great either. Writing your own exporter to your own intermediate text format from Maya or Blender would be good if you are up for it. From whatever source, make your own archive format and binary formats for meshes, animations, textures and scenes. Use https://github.com/lz4/lz4 for compression. You should be able to decompress a list of assets into a big linear array and use them right there with just a bit of pointer fix-up. Minimize the amount of memory you have to touch from start to finish. Data that is going to the GPU (textures, vertex/index buffers) should decompress straight into mapped buffers for fast uploads.
  • LZ4, an Extremely Fast Compression Algorithm
    9 projects | news.ycombinator.com | 27 Jan 2021
    I'm not a fan of the stacked bar charts, I like the table of data for "Benchmarks" on the github source page: https://github.com/lz4/lz4

    It makes it very clear where LZ4 fits into comparisons with compression speed, decompression speed and compression ratio

squashfs-tools-ng

Posts with mentions or reviews of squashfs-tools-ng. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-04-06.
  • C Strings and my slow descent to madness
    3 projects | news.ycombinator.com | 6 Apr 2023
    ... except that that is also subtly broken.

    It works if you write multiple UTF-8 code-units in one go, but breaks if you send them in several writes, or if you use the ANSI API (with the A suffix). Guess what the Windows implementation of stdio (printf and friends) does.

    I already had some fun with this: https://github.com/AgentD/squashfs-tools-ng/issues/96#issuec...

    And we didn't even discuss command line argument passing yet :-)

    I tried to test it with the only other two languages I know besides English: German and Mandarin. Specifically also, because the later requires multi-byte characters to work. Getting this to work at all in a Windows terminal on an existing, German Windows 7 installation was an adventure on it's own.

    Turns out, trying to write language agnostic command line applications on Windows is a PITA.

  • Getting the maximum of your C compiler, for security
    3 projects | news.ycombinator.com | 31 Aug 2021
    IIRC fanalyzer is a fairly recent addition to gcc. Has it become reasonable usable yet?

    I recall getting a bit excited when I first read about it, but the results I got where rather bizarre (e.g. every single function that allocated memory and returned a pointer to it was labeled as leaking memory).

    It did the fun exercise myself once to riffle through the gcc manpage, cobble together warning flags and massage them into autoconf[1][2].

    There is a very handy m4 script in the util-linux source for testing supported warning flags[3].

    [1] https://git.infradead.org/mtd-utils.git/blob/HEAD:/configure...

    [2] https://github.com/AgentD/squashfs-tools-ng/blob/master/conf...

    [3] https://github.com/karelzak/util-linux/blob/master/m4/compil...

  • Squashfs turning 20, Squashfs tools 4.5 released
    3 projects | news.ycombinator.com | 24 Jul 2021
    > Honestly I think you could be a little more respectful of the project that inspired yours.

    I do. I had a lot of great "Huh? That's clever!" moments while reverse engineering the format and formed a mental image of a clearly brilliant programmer who managed to squeeze the last bits out of some data structures using really clever tricks that I myself probably wouldn't have come up with. During that time I gained a lot of respect for the project and the author.

    Also, please don't forget: the whole project is the filesystem, the tools are just a part of that. I care about this project, which is why I decided to start this effort in the first place. Which I explicitly did not advertise as a replacement, but an augmentation (see [2]).

    > I'd be angry too ... Definitely understandable.

    Yes, I agree! And I can understand why in the heat of the moment you might write something angry and threatening. But certainly not if you've had a few weeks time to calm down and think things over.

    > And you plagiarized part of his readme.

    https://github.com/plougher/squashfs-tools/blob/master/RELEA...

    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...

    https://github.com/AgentD/squashfs-tools-ng/blob/master/READ...

    Oh yes? Which part?

    > ... calling it spaghetti code (which isn't immediately verifiable)

    Here you go, have fun: https://github.com/plougher/squashfs-tools/blob/master/squas...

    However, I cannot blame anyone here, I totally get how those things happen and have witnessed it myself in action:

    You write a simple tool supporting a larger project. It's written by the seat of your pants without much planning, since it's not big and does one simple job. Then it gets used in production, eventually requirements change, other people pile on patches, but try to keep the diff small, so it's reviewable and it receives maybe a little less care than the actual project it supports. Nobody bothers to overhaul it or write documentation because, hey, it works, and any large changes might risk breaking things.

    Even if nobody is to blame for it, the end result is still the same: an undocumented mess that is hard to wrap your head around if you aren't the original author, who is the only one with the bigger picture.

    I tried for roughly a week to pull the code (there are some more files than this and some of the inter dependencies are nasty) apart into stacked utility libraries and a pure command line parsing front end, with the hopes to maybe get this upstream once it is done. I gave up and decided that at this point I understood enough about the format to start afresh and not touch what I believed to be an unmaintained mess.

    3 projects | news.ycombinator.com | 24 Jul 2021
    Unlikely. Squashfs-tools-ng is not a fork but written from scratch after reverse engineering the format.

    I started it in early 2019 after being annoyed with various shortcomings in squashfs-tools and after trying to make sense out of the spaghetti source code to not only fix problems I ran into and add features I needed for a particular project.

    I saw the complete lack of activity on the official website and official git tree, from which I concluded it was pretty much dead. Of course I wanted to ask on the mailing list first (also pretty dead), but then I saw a thread from early 2018 talking about a release. Since the thread got a response that I interpreted as rather angry[1] and the release didn't happen a year later either, I concluded that the project is pretty much dead and decided to publish my own efforts and for lack of a better name simply named it "*-ng". Other people seemed to have drawn similar conclusions[2][3].

    We all later found out that the squashfs-tools git tree was simply moved to GitHub (without updating the kernel docs or "official" website to indicate this). But even there, activity fixing bugs only picked up after I made 3 or 4 releases already and announced them on the squashfs mailing list. At which point I finally got a response in the form of a few somewhat unfriendly words[5][6][7] that made me re-evaluate my interpretation of the e-mail I mentioned erlier.

    But at that point squashfs-tools version 4.4 fixed a bunch of issues that I publicly complained about and with this release got quite busy copying features that I found useful (and set squashfs-tools-ng apart).

    Given the distinct source trees and, lets call it "competitive nature", I'd say a merge is unlikely and I will continue maintaining my package. I wrote it to solve some specific problems I had and it IMO does that job quite well. It's nice if other people find it useful and I'm proud to have ended up contributing to the official squashfs-tools development by providing new motivation :-).

    [1] https://sourceforge.net/p/squashfs/mailman/message/36298345/

    [2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=931965

    [3] https://news.ycombinator.com/item?id=20518019

    [4] https://lkml.org/lkml/2019/8/1/1154

    [5] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=931965#29

    [6] https://lkml.org/lkml/2019/8/1/565

    [7] https://github.com/AgentD/squashfs-tools-ng/issues/10

  • The Byte Order Fiasco
    7 projects | news.ycombinator.com | 8 May 2021
    FWIW there is an on various BSDs that contains "beXXtoh", "leXXtoh", "htobeXX", "htoleXX" where XX is a number of bits (16, 32, 64).

    That header is also available on Linux, but glibc (and compatible libraries) put named it instead.

    See: man 3 endian (https://linux.die.net/man/3/endian)

    Of course it gets a bit hairier if the code is also supposed to run on other systems.

    MacOS has OSSwapHostToLittleIntXX, OSSwapLittleToHostIntXX, OSSwapHostToBigIntXX and OSSwapBigToHostIntXX in .

    I'm not sure if Windows has something similar, or if it even supports running on big endian machines (if you know, please tell).

    My solution for achieving some portability currently entails cobbling together a "compat.h" header that defines macros for the MacOS functions and including the right headers. Something like this:

    https://github.com/AgentD/squashfs-tools-ng/blob/master/incl...

    This is usually my go-to-solution for working with low level on-disk or on-the-wire binary data structures that demand a specific endianness. In C I use "load/store" style functions that memcpy the data from a buffer into a struct instance and do the endian swapping. The copying is also necessary because the struct in the buffer may not have proper alignment.

    In C++ code, all of this can of course be neatly stowed away in a special class with overloaded operators that transparently takes care of everything and "decays" into a single integer and exactly the above code after compilation, but is IMO somewhat cleaner to read and adds much needed type safety.

  • Tar is an ill-specified format
    3 projects | news.ycombinator.com | 29 Mar 2021
    I once foolishly thought, I'll write a tar parser because, "how hard can it be" [1].

    I simply tried to follow the tar(5) man page[2], and got a reference test set from another website posted previously on HN[3].

    Along the way I discovered that NetBSD pax apparently cannot handle the PAX format[3] and my parser inadvertently uncovered that git-archive was doing the checksums wrong, but nobody noticed because other tar parsers were more lax about it[4].

    As the article describes (as does the man page), tar is actually a really simple format, but there are just so many variants to choose from.

    Turns out, if you strive for maximum compatibility, it's easiest to stick to what GNU tar does. If you think about it, IMO in many ways the GNU project ended up doing "embrace, extend, extinguish" with Unix.

    [1] https://github.com/AgentD/squashfs-tools-ng/tree/master/lib/...

    [2] https://www.freebsd.org/cgi/man.cgi?query=tar&sektion=5

    [3] https://mgorny.pl/articles/portability-of-tar-features.html

    [4] https://www.spinics.net/lists/git/msg363049.html

  • LZ4, an Extremely Fast Compression Algorithm
    9 projects | news.ycombinator.com | 27 Jan 2021
    A while ago I did some simplistic SquashFS pack/unpack benchmarks[1][2]. I was primarily interested in looking at the behavior of my thread-pool based packer, but as a side effect I got a comparison of compressor speed & ratios over the various available compressors for my Debian test image.

    I must say that LZ4 definitely stands out for both compression and uncompression speed, while still being able to cut the data size in half, making it probably quite suitable for life filesystems and network protocols. Particularly interesting was also comparing Zstd and LZ4[3], the former being substantially slower, but at the same time achieving a compression ratio somewhere between zlib and xz, while beating both in time (in my benchmark at least).

    [1] https://github.com/AgentD/squashfs-tools-ng/blob/master/doc/...

    [2] https://github.com/AgentD/squashfs-tools-ng/blob/master/doc/...

    [3] https://github.com/AgentD/squashfs-tools-ng/blob/master/doc/...

What are some alternatives?

When comparing LZ4 and squashfs-tools-ng you can also consider the following projects:

zstd - Zstandard - Fast real-time compression algorithm

Snappy - A fast compressor/decompressor

brotli - Brotli compression format

LZMA - (Unofficial) Git mirror of LZMA SDK releases

ZLib - A massively spiffy yet delicately unobtrusive compression library.

squashfs-tools - tools to create and extract Squashfs filesystems

7-Zip-zstd - 7-Zip with support for Brotli, Fast-LZMA2, Lizard, LZ4, LZ5 and Zstandard

LZFSE - LZFSE compression library and command line tool

LZHAM - Lossless data compression codec with LZMA-like ratios but 1.5x-8x faster decompression speed, C/C++

RocksDB - A library that provides an embeddable, persistent key-value store for fast storage.

zlib-ng - zlib replacement with optimizations for "next generation" systems.