Legacy and LegacyOptimized Calculation Engines
- 3 minutes to read
Legacy is the originally developed data engine. Demonstrates acceptable performance if a data-source contains less than 100,000 rows. The engine is not optimized for summary and aggregate calculations. Best suited for a dozen of fields in the row area that contains mostly unique values.
The LegacyOptimized engine is available from v17.1. The engine supports the Legacy engine's features, inherited from legacy API, and increases data processing speed (up to 30 times faster). From v17.2, the Pivot Grid's LegacyOptimized mode can utilize multi-core processors for data operations. The control splits bound records into bulks and processes them in parallel threads. Data processing speed increases proportional to the number of CPU cores. Allows you to restore a layout configured in Legacy mode. From v18.2, LegacyOptimized is a default engine.
pivotGridControl1.OptionsData.DataProcessingEngine = PivotDataProcessingEngine.LegacyOptimized;
The Legacy and Legacy-optimized modes support bound and unbound fields:
- Bound fields retrieve data from the pivot grid's underlying data source.
- Unbound fields get data by evaluating an expression or handling an event. You can use unbound fields to construct and display user-friendly values in field headers. You can sort, group, and filter unbound fields like bound fields.
LegacyOptimized performs different data-related features in the following cases:
Data Sorting and Grouping.
The Legacy engine aggregates data after sorting at data source level. The Pivot Grid raises the CustomFieldSort event to compare different data rows and calls the CustomGroupInterval event for each data source row.
The LegacyOptimized engine sorts aggregated data. The LegacyOptimized engine raises the CustomFieldSort event to compare the resulting data groups and the CustomGroupInterval event for unique field values only.
The default summary values specified by the SummaryType property are calculated without converting values.
The Legacy engine converts all values to decimal and calculates summary values.
In Legacy-optimized mode, the SummaryType property specifies the default summary values and the Legacy-optimized engine performs calculations without converting values.
Calculated Fields are processed for fields with incorrect FieldName values.
The Legacy engine checks calculated fields’ FieldName and UnboundFieldName property values before processing. If names match the name of any data source column, the field is 'bound' and data is loaded from the data source. The LegacyOptimized engine does not verify field names and calculates all fields with any UnboundType property value except for Bound.
The IEnumerable.GetEnumerator method is used to read data source data.
The Legacy engine uses the IList.Item[Int32] property to read all data. The new LegacyOptimized engine uses the IList.Item[Int32] property to get values from specific data source rows, and uses the IEnumerable.GetEnumerator method to read data from the entire data source to improve performance.
UnboundExpressions are compiled before processing.
The Legacy engine processes UnboundExpressions for each row in the data source and can parse a String values to get DateTime or numbers.
The LegacyOptimized engine compiles the UnboundExpression once before data is processed. This approach provides faster processing, but has restrictions for the type of provided data. For example, you need to use ToDateTime, ToInt, ToDouble, and ToDecimal functions to parse string values.
The Legacy and LegacyOptimized modes do not support Data Binding API.