I noticed that inside
sn_node we pass around the struct
NodeInfo a lot, and make many copies redundantly, deep into struct hierarchies. Here’s just a handful of places I found it.
That’s not all of them, but I started following the thread and it goes really, really deep. My question is, what is the reasoning behind the high redundancy of the copying here? Surely, a single
<'a> reference would reduce the memory footprint, no?
I get that we’re passing around snapshots, but why not just pass around references? Or even an
Arc<RwLock> if the copying is for simple thread safety? I’m wondering because I want to change a field in this struct… at runtime… After initially attempting, I quickly realized that tracking down all of these copies is damn-near futile.
Is there a way to change these all at once? If not, is there anything stopping me from turning them all into references to a “master”
NodeInfo? They seem to all come from the top level
NodeDuties, but it seems overkill to reconstruct the entire
NodeDuties for the sake of changing a struct field…