Description
📰 Custom Issue
See also #4749 for a simpler fix and a description of the problem.
Currently, both the MeshCoord points and bounds and the data on the mesh they refer to are all mutable. In the case where the Mesh has already been realised before the MeshCoord has been created, the points will have the same underlying array as the Mesh data so changing one will change the other, however this is not true in all other cases. Furthermore, when the Mesh is lazy, all MeshCoords that derive from it will instantiate their own points and bounds so that if all derived MeshCoords are realised, the same data will exist in different copies, taking up more memory than may be necessary.
A possible suggestion to improve matters:
- Make points and bounds on MeshCoords read only properties.
- Have the points and bounds properties fetch data from the Mesh object. This may involve storing a private
_mesh_bounds
array on the Mesh when called for.
This approach would improve the memory performance when referencing the same Mesh multiple times and, unlike the solution proposed in #4749, may also allow the safe editing of the Mesh.