Giter Club home page Giter Club logo

Comments (38)

RJVB avatar RJVB commented on July 21, 2024 2

from afsctool.

malthe avatar malthe commented on July 21, 2024 1

@gingerbeardman thanks – I was planning to update that post once this is all merged in. Will try and see if I can come up with a command-line for ditto.

from afsctool.

RJVB avatar RJVB commented on July 21, 2024

from afsctool.

lucianmarin avatar lucianmarin commented on July 21, 2024

make install LZVN

Install the project...
/usr/local/Cellar/cmake/3.13.2/bin/cmake -P cmake_install.cmake
-- Install configuration: ""
-- Up-to-date: /usr/local/lib/libFastCompression.1.0.dylib
-- Up-to-date: /usr/local/lib/libFastCompression.1.dylib
-- Up-to-date: /usr/local/lib/libFastCompression.dylib
-- Up-to-date: /usr/local/lib/libFastCompression.a
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: /usr/local/lib/libFastCompression.a(liblzvn.c.o) has no symbols
-- Up-to-date: /usr/local/bin/lzvn
-- Up-to-date: /usr/local/include/lzvn.h
-- Up-to-date: /usr/local/include/FastCompression.h

cmake -Wno-dev .. afsctool (after last git pull)

-- LZVN_HEADER,LIB: /usr/local/include/FastCompression.h /usr/local/lib/libFastCompression.dylib
-- Enabling LZVN support
-- Setting afsctool version to: 1.6.9. (1.6.8.6-127-g731aeaa)

Later edit: seems to work when I do cmake .. instead of cmake -Wno-dev .. and make install instead of make install/fast for both projects.

afsctool -v afsctool
File is HFS+/APFS compressed.
Compression type: LZVN in resource fork (8)
Compression savings: 71.0%

from afsctool.

lucianmarin avatar lucianmarin commented on July 21, 2024

Can you make LZVN the default compression format if support is enabled?

afsctool -c afsctool
afsctool -v afsctool
File is HFS+/APFS compressed.
Compression type: ZLIB in resource fork (4)
Compression savings: 73.6%

I also get lzvn compression failed on chunk #0 on some files if they were previously ZLIB compressed then decompressed then compressed with LZVN. ZLIB works on those files, but LZVN doesn't. They are too tiny for LZVN compression. lzvn infile outfile produces a 0 bytes outfile.

from afsctool.

RJVB avatar RJVB commented on July 21, 2024

from afsctool.

gingerbeardman avatar gingerbeardman commented on July 21, 2024

LZVN works for me on High Sierra, so you'll need to check that you are compiling afsctool correctly.

I use:

afsctool -c -T LZVN "$@"

I'm using afsctool 1.6.9. (1.6.8.6-125-ge269dbf) as I've not built a new version in a while.

from afsctool.

RJVB avatar RJVB commented on July 21, 2024
I also get lzvn compression failed on chunk #0 on some files if they were previously ZLIB compressed then decompressed then compressed with LZVN. ZLIB works on those files, but LZVN doesn't. They are too tiny for LZVN compression. lzvn infile outfile produces a 0 bytes outfile.

I didn't notice this part. I'd need to have one of those files to do some testing, but if lzvn fails itself there probably isn't much I can do about that.

I don't really get why you'd want to recompress files with LZVN though. In every test I did it compresses less well than (higher levels of) ZLIB. It may decompress faster, but do you really notice that IRL? OS X has a rather agressive file cache, and to the best of my knowledge this comes after the file system (i.e. it caches data after "HFS decompression").

from afsctool.

gingerbeardman avatar gingerbeardman commented on July 21, 2024

FWIW I use LZVN because macOS App Store uses LZVN, and I mainly compress apps so I want to keep things the same as those apps.

from afsctool.

RJVB avatar RJVB commented on July 21, 2024

from afsctool.

gingerbeardman avatar gingerbeardman commented on July 21, 2024

I read that here the other day, and I countered by saying that Apple ship their OS and apps from the Mac App Store with HFS+ compression turned on, so I don't really see the reasoning?

My reason is not to "do it like Apple" but so that my scripts and workflow do not undo what Apple have done and then redo with the same. Also, LZVN is more efficient in terms of speed and CPU usage, so I don't notice when it's working in the background (compared to ZLIB that makes my fans go crazy). But, yes, whatever works for each of us.

Also, try FSNotes for an app that gives this:

/Applications/FSNotes.app/Contents/Resources/de.lproj/InfoPlist.strings: lzvn compression failed on chunk #0

from afsctool.

lucianmarin avatar lucianmarin commented on July 21, 2024

Also, try FSNotes for an app that gives this:

/Applications/FSNotes.app/Contents/Resources/de.lproj/InfoPlist.strings: lzvn compression failed on chunk #0

I can confirm this on multiple apps. LZVN utility produces 0 bytes output on the same files.

from afsctool.

RJVB avatar RJVB commented on July 21, 2024

from afsctool.

gingerbeardman avatar gingerbeardman commented on July 21, 2024

Thanks René!

from afsctool.

gingerbeardman avatar gingerbeardman commented on July 21, 2024

define for LZVN_MINIMUM_COMPRESSABLE_SIZE is missing in latest commit
make sure you pull, build and install the latest LZVN

from afsctool.

malthe avatar malthe commented on July 21, 2024

Now we just need ARM-support for LZVN :-)

from afsctool.

RJVB avatar RJVB commented on July 21, 2024

from afsctool.

malthe avatar malthe commented on July 21, 2024

In the library yeah – there's lots of assembly code in there.

from afsctool.

RJVB avatar RJVB commented on July 21, 2024

from afsctool.

RJVB avatar RJVB commented on July 21, 2024

from afsctool.

malthe avatar malthe commented on July 21, 2024

@RJVB works perfectly.

from afsctool.

RJVB avatar RJVB commented on July 21, 2024

from afsctool.

malthe avatar malthe commented on July 21, 2024

It takes quite a while, but this is an 8GB run:

Number of HFS+/APFS compressed files: 140960
Total number of files: 145251
Total number of folders: 20516
Total number of items (number of files + number of folders): 165767
Folder size (uncompressed; reported size by Mac OS 10.6+ Finder): 7840604172 bytes / 8.2 GB (gigabytes, base-10)
Folder size (compressed): 3696919434 bytes / 3.45 GiB
Compression savings: 52.8% over 140960 of 145251 files
Approximate total folder size (files + file overhead + folder overhead): 3704770889 bytes / 3.45 GiB

(Both LZVN and LZFSE tested.)

from afsctool.

gingerbeardman avatar gingerbeardman commented on July 21, 2024

@malthe off-topic, slightly, but regarding your (old) blog post: https://maltheborch.com/#using-built-in-transparent-compression-on-macos ditto is in-built tool that can do this (HFS+ in-place compression) to a degree, and Apple do it for all system files in an install and all apps installed/updated using the Mac App Store. Just an FYI

from afsctool.

gingerbeardman avatar gingerbeardman commented on July 21, 2024

@malthe from man it's ditto --hfsCompression src dest

from afsctool.

malthe avatar malthe commented on July 21, 2024

@gingerbeardman doesn't work if src is the same as dest though:

<src> and <dest> are identical (not copied).

from afsctool.

gingerbeardman avatar gingerbeardman commented on July 21, 2024

ah yes, you have to do a dance through a temporary file

from afsctool.

RJVB avatar RJVB commented on July 21, 2024

from afsctool.

gingerbeardman avatar gingerbeardman commented on July 21, 2024

I've heard that before, but my counter is that they apply this to the system and Mac App Store so they're doing more than nothing.

I do think they should enable it by default but there are so many issues that would raise.

Apple storage is pretty reasonable price these days.

from afsctool.

gingerbeardman avatar gingerbeardman commented on July 21, 2024

Oh, and I use CleanMyMac to trim language files which still works well.

Screen shot 2021-01-21 at 11 21 27

from afsctool.

RJVB avatar RJVB commented on July 21, 2024

from afsctool.

gingerbeardman avatar gingerbeardman commented on July 21, 2024

I presume "CleanMyMac" only removes language resources that are not inside app bundles, and possibly from apps that aren't signed (or are known not to be crippled when they lose their signing)?

I'd say: you presume too much :)

Well, I just installed OmniGraffle from the Mac App Store and it stripped the localisation out of that with no effect on the running of the app.

Screen shot 2021-01-21 at 12 47 45

before
Screen shot 2021-01-21 at 12 48 06

after
Screen shot 2021-01-21 at 12 48 38

from afsctool.

RJVB avatar RJVB commented on July 21, 2024

from afsctool.

Dr-Emann avatar Dr-Emann commented on July 21, 2024

BTW, According to libfsapfs (scroll past the table):

If the LZVN compressed data starts with 0x06 (end of stream oppcode) the data is stored uncompressed after the first compressed data byte.

Similar to how an 0xFF prefix can be used for zlib compression to store uncompressed data with only 1 byte overhead.

I think this could be used to handle cases where the last block is too small for LZVN (or if LZVN compression would ever increase the size of the block)

from afsctool.

RJVB avatar RJVB commented on July 21, 2024

from afsctool.

Dr-Emann avatar Dr-Emann commented on July 21, 2024

It looks like it's currently handled by rejecting the whole file:

afsctool/src/afsctool.c

Lines 239 to 246 in cadc2a3

if (comptype == LZVN){
int lastChunkSize = inFileInfo->st_size % 0x10000;
if (lastChunkSize > 0 && lastChunkSize < LZVN_ENCODE_MIN_SRC_SIZE) {
if (printVerbose >= 2) {
fprintf( stderr, "\"%s\": file too small or will contain a too small compression chunk (try ZLIB compression)\n",
inFile);
}
return false;

$ truncate -s $((0x10000 + 7)) /tmp/bad_block

$ ./afsctool -c -vvvv -T LZVN /tmp/bad_block
"/tmp/bad_block": file too small or will contain a too small compression chunk (try ZLIB compression)
"/tmp/bad_block": file too small or will contain a too small compression chunk (try ZLIB compression)
/tmp/bad_block:
Unable to compress file.
File content type: public.data
File data fork size (reported size by Mac OS X Finder): 65543 bytes / 70 KB (kilobytes, base-10)
Number of extended attributes: 0
Total size of extended attribute data: 0 bytes
Approximate total file size (data fork + resource fork + EA + EA overhead + file overhead): 69632 bytes / 68 KiB

from afsctool.

RJVB avatar RJVB commented on July 21, 2024

from afsctool.

RJVB avatar RJVB commented on July 21, 2024

from afsctool.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.