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

Add SIMD support for imagehash #50

Merged
merged 11 commits into from
Mar 14, 2023
Merged

Add SIMD support for imagehash #50

merged 11 commits into from
Mar 14, 2023

Conversation

evanoberholster
Copy link
Owner

Use of float32 array instead of float64 array. Uses less memory and able to apply faster SIMD functions.
YCbCr conversion to float32 is not exact and is approximate

name                      old time/op    new time/op    delta
PHash64/Fast32-12           37.3µs ± 1%     6.2µs ± 1%  -83.33%  (p=0.000 n=17+16)
PHash64/Fast-Parallel-12    6.25µs ± 1%    0.90µs ± 0%  -85.61%  (p=0.000 n=19+19)

name                      old alloc/op   new alloc/op   delta
PHash64/Fast32-12            0.00B          0.00B          ~     (all equal)
PHash64/Fast-Parallel-12     0.00B          0.00B          ~     (all equal)

name                      old allocs/op  new allocs/op  delta
PHash64/Fast32-12             0.00           0.00          ~     (all equal)
PHash64/Fast-Parallel-12      0.00           0.00          ~     (all equal)

Signed-off-by: Evan Oberholster <9270149+evanoberholster@users.noreply.github.com>
Signed-off-by: Evan Oberholster <9270149+evanoberholster@users.noreply.github.com>
@evanoberholster evanoberholster changed the title Add SIMD support for image hash Add SIMD support for imagehash Mar 13, 2023
@evanoberholster evanoberholster added enhancement New feature or request Performance Performance improvement labels Mar 13, 2023
@evanoberholster evanoberholster self-assigned this Mar 13, 2023
@evanoberholster
Copy link
Owner Author

Added support for DCTHash256.

name                       old time/op    new time/op    delta
PHash256/Fast-12              739µs ± 2%     124µs ± 3%     -83.21%  (p=0.000 n=20+20)
PHash256/Fast-Parallel-12     120µs ± 1%      16µs ± 1%     -86.29%  (p=0.000 n=20+20)

name                       old alloc/op   new alloc/op   delta
PHash256/Fast-12             3.89B ±234%  1033.00B ± 2%  +26462.86%  (p=0.000 n=18+20)
PHash256/Fast-Parallel-12    2.19B ±129%  1040.10B ± 1%  +47447.43%  (p=0.000 n=16+20)

name                       old allocs/op  new allocs/op  delta
PHash256/Fast-12               0.00           1.00 ± 0%       +Inf%  (p=0.000 n=20+20)
PHash256/Fast-Parallel-12      0.00           1.00 ± 0%       +Inf%  (p=0.000 n=20+20)

TODO:

  • Update and improve tests

@coveralls
Copy link

coveralls commented Mar 14, 2023

Pull Request Test Coverage Report for Build 4418030528

  • 46 of 52 (88.46%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+2.9%) to 33.826%

Changes Missing Coverage Covered Lines Changed/Added Lines %
imagehash/imagehash32.go 46 52 88.46%
Totals Coverage Status
Change from base Build 4275565407: 2.9%
Covered Lines: 1992
Relevant Lines: 5889

💛 - Coveralls

@evanoberholster evanoberholster merged commit 873e9d4 into master Mar 14, 2023
@evanoberholster evanoberholster deleted the dev-imagehash branch March 14, 2023 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Performance Performance improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants