image-rs / image-rs/imageproc

Performance

Open
#3 20 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
979
Forks
181
Avg merge
5m
Merged PRs (30d)
4

Description

It's currently pretty poor.

Benchmarking:

  • Make sure we have a sensible suite of benchmarks for all functions.
  • Write a tool to profile vs a selection of standard libraries (vlfeat, opencv, etc.).

Profiling and improving existing functions:

  • Do some!
  • Understand the cost of Rust operations/what LLVM can optimise away. e.g as well as being syntactically horrific, something like this looks expensive: (*out.get_pixel_mut(x, y))[0] += out.get_pixel(x, y - 1)[0]; I think that in theory this should all be optimised away, but maybe it's not.
  • Bounds checking, save vs unsafe. If we're doing something other than just iterate through all pixels in order then presumably eliding bounds checking is a lot trickier. Do we want to use unsafe everywhere? That seems a bit... unsafe.
  • Is there any benefit in exposing raw scanlines via a DirectImage trait (as exposed to GenericImage that just allows access to single pixels)?
  • Do we need any more abstractions for iterating over pixels/regions to let us get performance benefits safely?
  • Actually do the work to make all the existing functions reasonably performant.

Idioms/best practises:

  • Write up what we discovered from the profiling. Clearly document which operations are expensive, and how to avoid common pitfalls.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing image-processing functions and current benchmark coverage. Build benchmarks for the functions, then profile comparisons with standard libraries such as vlfeat and opencv, including the pixel-access and bounds-checking examples mentioned. Done means measured performance improvements, documented profiling findings and pitfalls, and a decision on safe iteration or scanline abstractions.

Written by the indexing model from the issue text.

Assessment

Tech stack
opencv, rust
Domain
computer-vision, documentation, performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.