Best practices with ComponentArrays.jl

Performance-wise, it probably doesn’t matter much. I think the first version is almost always better for organization, though. That way M1 and M2 are separate unit-testable functions that don’t need to care about what the outer organization of the θ structure looks like. Or, to put it another way, M is the outer function that should be in responsible for sending its inner components to where they need to go. M1 and M2 shouldn’t have to know anything about the outer structure of θ–that’s M’s job.

2 Likes