Spread Windows Forms 18
Spread Windows Forms 18 Product Documentation / Developer's Guide / Spreadsheet Objects / Ways to Improve Performance
In This Topic
    Ways to Improve Performance
    In This Topic

    You can use the following methods to improve the performance of Spread Winforms control.

    Note: You can also improve the performance by suspending layout logic. For more information, refer Improving Performance by Suspending the Layout.

    Improve Performance Using CacheOptions

     The performance of following formula functions can be improved with exact match.

    The CacheOptions enumeration in CalculationEngine class can be used to define the type of caching while using these functions:

    The performance is improved in the following order:

    Aggressive > On > None

    The following example applies Aggressive CacheOptions option and records the time taken to load the imported Excel file.

    C#
    Copy Code
    fpSpread1.AsWorkbook().WorkbookSet.CalculationEngine.CacheOptions = CacheOptions.Aggressive;
    // Sample Excel file containing XMATCH function
    fpSpread1.OpenExcel("bigTable - XMatch.xlsx");
    Stopwatch stopwatch = new Stopwatch();
    stopwatch.Start();
    // We check the performance by measuring the time to invoke Calculate only
    fpSpread1.AsWorkbook().WorkbookSet.CalculationEngine.Calculate(fpSpread1.AsWorkbook(), true);
    stopwatch.Stop();
    long miliseconds = stopwatch.ElapsedMilliseconds;
    listBox1.Items.Add(miliseconds.ToString());