JuliaImages / JuliaImages/juliaimages.github.io

document the array-of-structure and structure-of-array layout

Open
#154 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

best practice
Dominant language
Julia
Stars
33
Forks
52
PR merge metrics
No merged PRs in 30d

Description

JuliaImages uses the array of structure layout to fully use the multiple dispatch mechanism without introducing too many ambiguities. Intrinsically, this array-of-structure layout is slower than structure-of-array layout when we need a contiguous memory per channel.

For example, compute the norm of a RGB image:

julia> versioninfo()
Julia Version 1.6.0-DEV.850
Commit bf886b5953 (2020-09-06 08:55 UTC)

julia> x = rand(RGB{Float64}, 100, 100);

julia> cx = collect(channelview(x));

julia> @btime norm($x)
  28.822 μs (0 allocations: 0 bytes)
100.60011111008363

julia> @btime norm($cx)
  7.552 μs (0 allocations: 0 bytes)
100.60011111008343

julia> @btime norm(channelview($x)) # 😢 
  99.228 μs (2 allocations: 112 bytes)

I was only aware of this issue months ago and still not very familiar with this topic, @timholy would you mind giving a section or page documenting aspects that we need to be aware of wrt this? These differences might be emphasized in the docs because most other image processing libraries use the structure-of-array layout.

Contributor guide

No contributing guide indexed for this repository

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 with the issue's Julia benchmark examples and locate the relevant documentation entry point in JuliaImages. Document the array-of-structure and structure-of-array layouts, their trade-offs, and the channelview performance implications; done means users can understand when each layout is appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
documentation, performance
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.