Skip to content

Make Spin mutable to avoid allocations? #69

Description

@JeffFessler

Currently, Spin and SpinMC are immutable, whereas many of the other composite types here are mutable, like Position and Magnetization, and BlochMatrix.

When using BlochSim to fit a signal model to data, one must create a new Spin for every candidate set of tissue parameters and then propagate that spin through the dynamics. The propagation part is low allocation, thanks to all the in-place operations. The Spin allocation becomes magnified when considering slice profile effects with multiple spins across a voxel.

Making Spin mutable could avoid that allocation.

Would there be any performance drawback?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions