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

Use slices for image data #24

Merged
merged 1 commit into from
Oct 12, 2020
Merged

Use slices for image data #24

merged 1 commit into from
Oct 12, 2020

Conversation

kornelski
Copy link
Contributor

  • Makes extend_from_slice manage img_buf's capacity, which avoids reallocations
  • safe copy_u8_to_i32 generates the same assembly for the inner loop
  • ImageData can actually have a correct lifetime

@jjhbw
Copy link
Collaborator

jjhbw commented Oct 12, 2020

LGTM! Seems like a solid safety and readability improvement.

Did you observe a speedup by chance? I think I see a very small one in detect (<1%). I'm trying to understand criterion a little better, and it seems its not really reliable on my machine. Probably a macOS thing.

Thanks for your great PRs by the way! Out of interest, is there any particular reason that you're hacking on rustface?

@jjhbw jjhbw merged commit 6102843 into atomashpolskiy:master Oct 12, 2020
@kornelski
Copy link
Contributor Author

I'm not sure about speed, because I can't set a baseline in criterion. Hey, it's even same issue you've had: bheisler/criterion.rs#193

@kornelski kornelski deleted the slices branch October 12, 2020 14:15
@jjhbw
Copy link
Collaborator

jjhbw commented Oct 12, 2020

Yeah, I have to use the 'previous benchmark' as a baseline each time... Can get a little annoying as you'll need to run a benchmark of your baseline implementation each time, or manually delete the previous run in /target/criterion.

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.

2 participants