Skip to content

Performance #198

@gilidio8

Description

@gilidio8

Hi friend, how are you? I ended up finding a performance problem in the formulas when I reference another cell, I'll send you the code I used as an example:

protected override void OnAfterRender(bool firstRender)
{   
    Sheet = new Sheet(900, 100);
    Sheet.Commands.PauseHistory();
    Sheet.BatchUpdates();

    for (int row = 0; row <= 900; row++)
    {
        
        for (int col = 0; col <= 100; col++)
        {  
            if(row < 14)
                Sheet.Cells.SetFormula(row, col, $"=(({row}+{col}*{3})/100)");

            if (row >= 14 )
            {
                Sheet.Cells.SetFormula(row, col, $"=(B{row} + 5)");
            }
        }
    }
    
    Sheet.EndBatchUpdates();
    Sheet.Commands.ResumeHistory();
    base.OnAfterRender(firstRender);
}

I used it in Formula.razor
If you run it without the if (row < 14 ) just with
Sheet.Cells.SetFormula(row, col, $"=(({row}+{col}*{3})/100)") it will be super fast!

If you use Sheet.Cells.SetFormula(row, col, $"=(B{row} + 5)") it will take 5 minutes.
Do you know what it could be?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions