insertRecord currently recomputes totalLength with estimateLength for every new bundle over all bundles already in there (n-squared issue).
Instead the outAdu could hold the aggrLength as a property and the aggrLength is added the current bundles length on insert and then this pre-computed one is used.
insertRecord currently recomputes totalLength with estimateLength for every new bundle over all bundles already in there (n-squared issue).
Instead the outAdu could hold the aggrLength as a property and the aggrLength is added the current bundles length on insert and then this pre-computed one is used.