nix-bundle icon indicating copy to clipboard operation
nix-bundle copied to clipboard

Faster startup using lz4?

Open jb55 opened this issue 8 years ago • 11 comments

I think this would require a custom archiver that can bootstrap lz4 decompression

jb55 avatar May 03 '17 18:05 jb55

@jb55 have you run benchmarks between squashfs and lz4? We'd be interested in those for AppImageKit, too.

probonopd avatar May 03 '17 18:05 probonopd

@probonopd I'm going off generic compression benchmarks where lz4 wins in speed by a large margin. I haven't tested lz4 in squashfs, although it looks like it's supported?

jb55 avatar May 03 '17 18:05 jb55

You are right...

probonopd avatar May 03 '17 18:05 probonopd

We did some measurements using gzip (instead of bzip) and the difference is not too big (a few percent quicker). Would be interesting to give lz4 also a try (but arx doesn't implement it).

domenkozar avatar Feb 26 '18 14:02 domenkozar

Yeah I think biggest savings will come with "mounting" instead of "extracting". FUSE should give us that and I believe it's supported on most systems.

matthewbauer avatar Feb 26 '18 18:02 matthewbauer

https://github.com/input-output-hk/daedalus/blob/10c9d349bcb964c0c5693a9bd484759d372b21f6/nix-bundle.nix#L63

over here, the bundle pre-unpacks the entire thing to a known directory, and generates things like a .desktop file then when the user launches the application, its already unpacked, and the helper script just runs nix-user-chroot against the pre-unpacked dir

cleverca22 avatar Mar 05 '18 16:03 cleverca22

@cleverca22 clever

jb55 avatar Mar 05 '18 17:03 jb55

but ive also ran into an issue, i'm treating the bundle purely as an installer/updater, but i cant run it from within the namespace for self-updating

cleverca22 avatar Mar 05 '18 17:03 cleverca22

the bundle pre-unpacks the entire thing to a known directory

That will be much slower than loop-mounting using FUSE (as AppImage does), and will need additional space. Think about bundles that are GBs large.

probonopd avatar Mar 05 '18 21:03 probonopd

yeah, depends on your use-case and how big things are

i also recently discovered pigz and pixz, which just perform gzip or xz across multiple cores, but the user would have to have them installed before arx could make use of it

cleverca22 avatar Mar 06 '18 01:03 cleverca22

According to multiple benchmarks online (like for example: https://www.rootusers.com/gzip-vs-bzip2-vs-xz-performance-comparison/), bzip2 seems to be significantly slower to unpack than gzip and lzma.

gzip would be the fastest but doesn't have good compression ratio. In https://github.com/matthewbauer/nix-bundle/pull/69 I swapped out bzip2 with xz -1 which should improve upon compression/decompression speed and also file size. Also it now uses all available cores for compression.

DavHau avatar Nov 16 '20 05:11 DavHau