-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Refactored Perceptionhash for performance #54
Conversation
Comparison between PerceptionHash and PerceptionHashFast: name old time/op new time/op delta
PerceptionHash-12 945µs ± 9% 689µs ± 2% -27.08% (p=0.000 n=170+177)
name old alloc/op new alloc/op delta
PerceptionHash-12 471kB ± 0% 298kB ± 0% -36.80% (p=0.000 n=174+198)
name old allocs/op new allocs/op delta
PerceptionHash-12 4.74k ± 0% 0.07k ± 0% -98.61% (p=0.000 n=200+200) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@evanoberholster Looks nice! Thank you for your contribution!!
If you want me to change the name to replace existing function that would be acceptable.
I prefer this one(change the name ) :)
Please add your name to the following file. |
Thanks, I love all of your changes :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you like to switch the PerceptionHashFast into PerceptionHash and remove old implementation(including old dct implementation)?
hashcompute.go
Outdated
// Uses static DCT tables for improved performance. | ||
// Implementation follows | ||
// http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html | ||
func PerceptionHashFast(img image.Image) (*ImageHash, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func PerceptionHashFast(img image.Image) (*ImageHash, error) { | |
func PerceptionHash(img image.Image) (*ImageHash, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made these changes in new update.
PerceptionHashFast DCT static tables only support a size of 64x64. We would need to include further static tables to support other image sizes, (eg 256x256) |
Ah okay, let's replace PerceptionHash only. |
Sorry for the delay I have been busy at work. Will get it replaced and update the PR. |
Yeah, Don't worry I can wait :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost looks good to me, Just 1 nit comment and I will take a look at more later :)
Thanks for the change!
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
I agree that those tests are redundant. Thanks. |
Refactored PerceptionHash for performance. If you want me to change the name to replace existing function that would be acceptable.
Features: