Skip to content

Conversation

trotzig
Copy link
Contributor

@trotzig trotzig commented Feb 1, 2020

I was tracking down a performance issue with a large diff on happo.io
and found that the shortcut we take when images are "similar enough"
wasn't fast enough. The hashing process takes a little while on large
images and we don't really need the hashing for the similarEnough
function to run. I rewrote it so that it would operate on unhashed image
arrays instead, plus made it early-bail so that we won't have to iterate
through the whole image when we already know it's not similar enough.

I was tracking down a performance issue with a large diff on happo.io
and found that the shortcut we take when images are "similar enough"
wasn't fast enough. The hashing process takes a little while on large
images and we don't really need the hashing for the similarEnough
function to run. I rewrote it so that it would operate on unhashed image
arrays instead, plus made it early-bail so that we won't have to iterate
through the whole image when we already know it's not similar enough.
@trotzig
Copy link
Contributor Author

trotzig commented Feb 1, 2020

I gave this a try on a diff on a 800px x 5000px image and it cuts down diffing time by approximately 2s (Down from 4s to 2s). Still not great but at least a lot better!

@trotzig trotzig merged commit ecea358 into master Feb 1, 2020
@trotzig trotzig deleted the similar-enough-quicker branch February 1, 2020 19:56
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

Successfully merging this pull request may close these issues.

1 participant