Closed ydewit closed 1 year ago
Preliminary results are substantial:
2023-10-11T18:21:05.135708Z INFO rinet::inet::runtime: REWRITES: 1100762
2023-10-11T18:21:05.135713Z INFO rinet::inet::runtime: CELL REUSES: 1938685
2023-10-11T18:21:05.135716Z INFO rinet::inet::runtime: CELL INSTANTIATIONS: 316883
2023-10-11T18:21:05.135720Z INFO rinet::inet::runtime: VAR INSTANTIATIONS: 4661012
In this specific case containing various fib calculations at the same time, we are able to reuse close to 85% of cell instantiations. For each rule, we are able to reuse up to 2 cells. Considering that the rule body tends to be have a small number of equations, the reuse is a significant portion of all instantiations.
We are in effect saving a pair of free() and a malloc() which ends up reading and writing the cell arena and pushing and popping an item to the free array.
The current approach of consuming two cells with every rewrite, potentially requiring additional cells, and then freeing them only to reallocate later, incurs unnecessary overhead. This issue aims to explore the direct reuse of CellPtr to enhance efficiency by avoiding the overhead associated with frequent allocation and deallocation of cells.