Live data from Hacker News

Hyperspace

hypercritical.co

171–180 of 503 posts

Re: Hyperspace

#171

I gave it a try on my massive folder of NodeJS projects but it only found 1GB of savings on a 8.1GB folder. I then tried again including my user home folder (731K files, 127K folders, 2755 eligible files) to hopefully catch more savings and I only ended up at 1.3GB of savings (300MB more than just what was in the NodeJS folders.) I tried to scan System and Library but it refused to do so because of permission issues.…

[deleted]

Re: Hyperspace

#172
post #153

Earlier quoted context omitted.

I'd hash the first 1024 bytes of all files, and starts from there is any collision. That way you don't need to hash the whole (large) files, but only those with same hashes.

At that point, why hash them instead of just using the first 1024 bytes as-is?

In order to check if a file is a duplicate of another, you need to check it against _every other possible file_. You need some kind of "lookup key".

If we took the first 1024 bytes of each file as the lookup key, then our key size would be 1024 bytes. If you have 1 million files on your disk, then that's 128MB of ram just to store all the keys. That's not a big deal these days, but it's also annoying if you have a bunch of files that all start with the same 1024 bytes -- e.g. perhaps all the photoshop documents start with the same header. You'd need a 2-stage comparison, where you first match the key (1024 bytes) and then do a full comparison to see if it really matches.

Far more efficient - and less work - If you just use a SHA256 of the file's contents. That gets you a much smaller 32 byte key, and you don't need to bother with 2-stage comparisons.

Re: Hyperspace

#173

> Hyperspace can’t be installed on “Macintosh HD” because macOS version 15 or later is required. macOS 15 was released in September 2024, this feels far too soon to deprecate older versions.

He wanted to write it in Swift 6. Does it support older OS versions?

Swift 6 is not the problem. It's backward compatible.

The problem is SwiftUI. It's very new, still barely usable on the Mac, but they are adding lots of new features every macOS release.

If you want to support older versions of macOS you can't use the nice stuff they just released. Eg. pointerStyle() is a brand new macOS 15 API that is very useful.

Re: Hyperspace

#174
post #162
post #141

Earlier quoted context omitted.

Can it really be seen as deprecating an old version when it’s a brand new app?

I'm a bit confused as the Mac App Store says it's over 4 years old.

The 4+ Age rating is like, who can use the app. Not for 3 year olds, apparently.

Re: Hyperspace

#175
post #153

Earlier quoted context omitted.

I'd hash the first 1024 bytes of all files, and starts from there is any collision. That way you don't need to hash the whole (large) files, but only those with same hashes.

At that point, why hash them instead of just using the first 1024 bytes as-is?

And why first 1024, can pick from predefined points.

Re: Hyperspace

#176
Requires macOS 15.0 or later. – Oh god, this is so stupid and most irritating thing about macOS "Application development".

It is really unfair to call it "software" it is more like "glued to recent version of OS ware", meanwhile I can still run .exe compiled in 2006, and with wine even on mac or linux.

Re: Hyperspace

#177

Earlier quoted context omitted.

It should be proportional to the total used space, not the space available. The previous commenter said it was a 1 GB savings from ~8 GB of used space; that's equally significant whether it happens on a 10 GB drive or a 10 TB one.

He picked node_modules because it's highly likely to encounter redundant files there. If you read the rest of the comment he only saved another 30% running his entire user home directory through it. So this is not a linear trend based on space used.

He "only" saved 30%? That's amazing. I really doubt most people are going to get anywhere near that.

When I run it on my home folder (Roughly 500GB of data) I find 124 MB of duplicated files.

At this stage I'd like it to tell me what those files are - The dupes are probably dumb ones that I can simply go delete by hand, but I can understand why he'd want people to pay up first, as by simply telling me what the dupes are he's proved the app's value :-)

Re: Hyperspace

#178

What algorithm does the application use to figure out if two files are identical? There's a lot of interesting algorithms out there. Hashes, bit by bit comparison etc. But these techniques have their own disadvantages. What is the best way to do this for a large amount of files?

I don't know exactly what Siracusa is doing here, but I can take an educated guess: For each candidate file, you need some "key" that you can use to check if another candidate file is the same. There can be millions of files so the key needs to be small and quick to generate, but at the same time we don't want any false positives. The obvious answer today is a SHA256 hash of the file's contents; It's very fast, not t…

[deleted]

Re: Hyperspace

#179
post #148
post #49

Earlier quoted context omitted.

pnpm tries to be a drop-in replacement for npm, and dedupes automatically.

More importantly, pnpm installs packages as symlinks, so the deduping is rather more effective. I believe it also tries to mirror the NPM folder structure and style of deduping as well, but if you have two of the same package installed anywhere on your system, pnpm will only need to download and save one copy of that package.

npm's --install-strategy=linked flag is supposed to do this too, but it has been broken in several ways for years.

Re: Hyperspace

#180

What algorithm does the application use to figure out if two files are identical? There's a lot of interesting algorithms out there. Hashes, bit by bit comparison etc. But these techniques have their own disadvantages. What is the best way to do this for a large amount of files?

I don't know exactly what Siracusa is doing here, but I can take an educated guess: For each candidate file, you need some "key" that you can use to check if another candidate file is the same. There can be millions of files so the key needs to be small and quick to generate, but at the same time we don't want any false positives. The obvious answer today is a SHA256 hash of the file's contents; It's very fast, not t…

You can start with the size, which is probably really unique. That would likely cut down the search space fast.

At that point maybe it’s better to just compare byte by byte? You’ll have to read the whole file to generate the hash and if you just compare the bytes there is no chance of hash collision no matter how small.

Plus if you find a difference in bytes 1290 you can just stop there instead of reading the whole thing to finish the hash.

I don’t think John has said exactly how on ATP (his podcast with Marco and Casey), but knowing him as a longtime listener/reader he’s being very careful. And I think he’s said that on the podcast too.

Post reply on HN