Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestions for fast bulk comparison? #80

Open
salamanders opened this issue Jul 9, 2020 · 0 comments
Open

Suggestions for fast bulk comparison? #80

salamanders opened this issue Jul 9, 2020 · 0 comments

Comments

@salamanders
Copy link

I've generated and cached a chromaprint for 10k files.
Now I'd like to find duplicates.

My naive method is N^2:

prints.forEachIndexed { index, print ->
  val smallestNotSelf = prints.drop(index + 1).minByOrNull { chromaDistance(print, it) }
  // ... do stuff with smallestNotSelf...
}

fun chromaDistance(cl0: List<UInt>, cl1: List<UInt>): Double = cl0.zip(cl1).map { (c0, c1) ->
    (c0 xor c1).countOneBits()
}.average()

Is there a faster way to do all the comparisons?
Can I bail on a comparison if the first few ints are horribly different?
Do I have to compare everyone to everyone?
Maybe I can ditch anything with widely different lengths...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant