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

DarknetImage move float conversion into c code #25

Merged
merged 1 commit into from
Mar 5, 2022
Merged

Conversation

lian
Copy link

@lian lian commented Mar 2, 2022

imgTofloat32 + fill_image_f32 took more than double the time since tofloat created needless allocations and iterate over each pixel, and fill_image in c then iterate over each pixel*3 again just to move it into the c image.

also add ImageRGBA2Float32 to optionally skip the draw.Copy call.

imgTofloat32 + fill_image_f32 took more than double the time since tofloat created needless allocations and iterate over each pixel, and fill_image in c then iterate over each pixel*3 again just to move it into the c image.
@LdDl LdDl self-assigned this Mar 3, 2022
@LdDl LdDl added the enhancement New feature or request label Mar 3, 2022
@LdDl
Copy link
Owner

LdDl commented Mar 3, 2022

@lian , thanks for PR
I hope everything else works as intended)

I'll take a look into commit soon

p.s. some benchmarks would be great to see also :) (what performance gain would we expect?)

@lian
Copy link
Author

lian commented Mar 4, 2022

name              old time/op    new time/op    delta
Image2Float32-32    7.98ms ± 4%    5.19ms ± 9%  -35.04%  (p=0.000 n=10+10)

name              old alloc/op   new alloc/op   delta
Image2Float32-32    12.0MB ± 0%     1.7MB ± 0%  -85.71%  (p=0.000 n=9+9)

name              old allocs/op  new allocs/op  delta
Image2Float32-32      7.00 ± 0%      3.00 ± 0%  -57.14%  (p=0.000 n=10+10)

@LdDl LdDl merged commit 51c7e39 into LdDl:master Mar 5, 2022
@LdDl
Copy link
Owner

LdDl commented Mar 5, 2022

approved and merged
next action would be updating release tag)

Thank you for PR

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

Successfully merging this pull request may close these issues.

None yet

2 participants