Closed alex-kulakov closed 1 year ago
@SergeiPavlov, this should reduce memory usage, especially on big models without lazy columns (declared lazy in FieldAttribute). Similar to List<T>
, it may waste some array space, but not more than (number of lazy columns + TypeId column) but it doesn't use copying when capacity of list changes. Since list grows x2 every time for regular columns we could easily stuck with inner array of 32 items with 15 wasted items or worse. Statistically, memory consumption will grow if >50% of all of columns in index are lazy but I assume it is very rare case.
P.S. On my test model of 400 entities in 200 hierarchies containing 8700 IndexInfo
instances (domain.Model.Types.SelectMany(t => t.Indexes).Count()
), this change reduced allocated memory by 1 MB (from 244MB down to 243MB).
Looks good to me
ColumnIndexMap
for real-world models, reduce amount of lists (and capacity changes)This should be merged after #297.