SciML / SciML/ComponentArrays.jl

Use map-do block for constructor

Open
#29 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
375
Forks
42
Avg merge
7h 25m
Merged PRs (30d)
17

Description

The standard constructor goes through the NamedTuple and pushes values to the data array one at a time. There are two problems with this:

  1. It’s really slow. Now that there is a constructor for creating new ComponentArrays with additional fields from old ones, it is reasonable to expect to use this in a hot loop. With a do block, it should be a lot faster.

  2. Zygote doesn’t allow array mutation, so the standard ComponentArray constructor is not differentiable (the ComponentArray(data, axes) one is, though).

Both of these are related to issue #22

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 at the standard ComponentArray constructor and compare it with the ComponentArray(data, axes) constructor, then review related issue #22. The change is done when construction avoids the described array mutation, improves hot-loop performance, and remains differentiable with Zygote.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.