corelibraries-401531-devexpress-pivot-grid-core-library-pivot-grid-modes-in-memory-mode-legacy-and-legacy-optimized-calculation-engines.md
Legacy is the originally developed data engine that can be used if a data-source contains less than 100,000 rows. The engine is not optimized for summary and aggregate calculations. Instead, Legacy is designed to operate with a dozen fields in the row area that contain mostly unique values.
The LegacyOptimized engine is available in v17.1 and higher. The engine supports the Legacy engine’s features, inherited from the legacy API, and increases data processing speed by up to 30 times. In v17.2 and higher, this mode can utilize multi-core processors for data operations: the control splits bound records into bulks and processes them in parallel threads, and the data processing speed increases proportionally to the number of CPU cores. This mode also allows you to restore a layout configured in Legacy mode. In v18.2 and higher, LegacyOptimized is the default engine.
To switch to the LegacyOptimized engine, set the PivotGridOptionsData.DataProcessingEngine property to DataProcessingEngine.LegacyOptimized:
pivotGridControl1.OptionsData.DataProcessingEngine = PivotDataProcessingEngine.LegacyOptimized;
pivotGridControl1.OptionsData.DataProcessingEngine = PivotDataProcessingEngine.LegacyOptimized
Microsoft’s Contoso Database is used to measure Pivot Grid’s performance for different versions. The test query returns 3.4M records. We requested values from ProductName, ProductSubcategoryName, ProductCategoryName, and DateKey dimensions, and SalesAmount, and SalesQuantity measures. The Pivot Grid displays both SalesAmount and SalesQuantity fields, groups data by ProductName, ProductSubcategoryName, ProductCategoryName field values and implements the Year → Quarter → Month hierarchy from the DateKey source field.
As you can see in the above table, the LegacyOptimized engine (available in v17.1 and higher) increases data processing speed in comparison to the Legacy engine (v16.2).
The Legacy and LegacyOptimized modes support bound and unbound fields:
Tip
Documentation :
LegacyOptimized and Legacy modes use an API that is not supported in Optimized mode.
LegacyOptimized performs different data-related features in the following cases:
Data Sorting and Grouping.
The default summary values specified by the SummaryType property are calculated without converting values.
Calculated Fields are processed for fields with incorrect FieldName values.
The IEnumerable.GetEnumerator method is used to read data from a data source.
Unbound expressions are compiled before processing.
For information about Legacy and Legacy Optimized mode restrictions, refer to the following article: In-Memory Mode Limitations.