From d384c196b7a227404840ba2a8e9718fe21c8b556 Mon Sep 17 00:00:00 2001 From: Jean-Gabriel Gill-Couture Date: Wed, 26 Jul 2023 22:22:34 -0400 Subject: [PATCH] Plan data structure refactoring to avoid Rc and RefCell, totally optionnal but nice way to learn --- src/space_colonization/space_colonization.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/space_colonization/space_colonization.rs b/src/space_colonization/space_colonization.rs index 0fbf471..ba50803 100644 --- a/src/space_colonization/space_colonization.rs +++ b/src/space_colonization/space_colonization.rs @@ -42,6 +42,10 @@ pub struct SpaceColonization { /// /// If density is 10, then there will be an average distance of 10 between attractors density: i32, + // TODO learning opportunity : avoid Rc and RefCell to have memory contiguous, increase + // performance and simplify code. Using a mutable struct instead of pointers to nodeswill + // improve performance. If required, use ids to point to nodes, those ids can be simply their + // indices in the array. If the node pointed to is deep, the index can be a vec or a tuple. new_nodes: RefCell, Rc)>>, /// Tree like representation of all nodes /// [node: [child1: [grand-child], child2: [grand-child2]]]