-
Notifications
You must be signed in to change notification settings - Fork 204
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
image.GetPoint() is extremely slow #408
Comments
Converting via ToImage to the golang image.Image and then using At instead seems to make it work in milliseconds |
Hey @MTRNord, thanks for this. I don't have a clear answer unfortunately. Is it possible for you to try profiling the govips part? |
Hi So I ran this now and I got this: (I ran it on my original code)
so the FFI seems to be either quite expensive or libvips is here. Libvips was started like this:
The profile is at https://github.com/MTRNord/pdqhash-go/blob/2290c5881ff302dc009ac741b92a8682a39c1a38/q0004.prof The profile was made based on the commit at https://github.com/MTRNord/pdqhash-go/tree/2290c5881ff302dc009ac741b92a8682a39c1a38 with scanner being build using I hope that helps and if not I am happy to add more info :) |
Looking at this I wonder if golang/go#19574 and similar issues are related here possibly. |
Oh and the problematic call is at https://github.com/MTRNord/pdqhash-go/blob/2290c5881ff302dc009ac741b92a8682a39c1a38/pdq_hasher.go#L160 which is called for every pixel in the image. |
While this works in general I realised that this will introduce some slight (compression? quality?) error which in my case makes it fail as hashes are not generated as they should be :) |
Hi.
I am trying to reimplement the pdq hash algorithm in go and need to access all pixels and their r g b values individually for the whole image. It seems to work fine up until I call
image.GetPoint
. Doing this seems to significantly (speak SECONDS per iteration aka about 2 minutes for the whole file) slow down the process.I am not sure why its slow.
The code used is like this:
where image is a reference to the image. The rest is semi relevant only. I verified that the GetPoint call specifically is the slow part of the loop.
Any ideas what might be going on or how to make it faster?
The text was updated successfully, but these errors were encountered: