Closed dvadym closed 2 years ago
This is done for performance reasons - it's much faster to work with tuples and serialized size of tuples is ~10 times smaller.
It turned out that the changes are pretty small and the resulting code structuring is nice:
def create_accumulators(): ... return Accumulator(...)
After
def create_accumulators(): ... return (...) # the same code, just Accumulator name dropped
2. Before
def compute_metrics(acc)
def compute_metrics(acc) field1, field2.. = acc
Also, it's introduced a base class for UtilityAnalysisCombiners.
This is done for performance reasons - it's much faster to work with tuples and serialized size of tuples is ~10 times smaller.
It turned out that the changes are pretty small and the resulting code structuring is nice:
def create_accumulators(): ... return (...) # the same code, just Accumulator name dropped
def compute_metrics(acc)
using acc.field1, acc.field2 etc
def compute_metrics(acc) field1, field2.. = acc
replace acc.field1 -> field1 ...