Performance issues

Posted by: lars-fp on 8 September 2017, 2:35 pm EST

  • Posted 8 September 2017, 2:35 pm EST

    I'm finding that writing into a large number of rows/cells to be very slow. Is there a faster way to do this?  (Assuming the "temp" values are different for each cell)

    The following takes 14 sec to run (in Debug mode).  (Where Columns is 20)

               
                MySheet.RowCount = 450;
                for (int i = 0; i < 450; i++)
                {
                    foreach (FP.Spread.Column column in MySheet.Columns)

                    {

                         MySheet.Cells[row, column.Index].Text = "temp";

                    }
                }

    Thanks for the help!

  • Replied 8 September 2017, 2:35 pm EST

    It's about 8 seconds in a Release build.
  • Replied 8 September 2017, 2:35 pm EST

    I'm not sure how much it will help but you can try putting fpSpread1.SuspendLayout() before your loop and fpSpread1.ResumeLayout() after your loop.
  • Replied 8 September 2017, 2:35 pm EST

    Yup.   The performance numbers that I provided are with the layout suspended.

     Any other ideas how to populate data in a faster manner or is this the expected performance of Spread?

     Thanks for the reply. 

  • Replied 8 September 2017, 2:35 pm EST

    Hello,

    Using the Text property is expensive in terms of performance because it includes parsing, I would suggest you to try switching to
    the Value property so the text in the cell isn't subjected to parsing.

    Thanks.

  • Replied 8 September 2017, 2:35 pm EST

    Wow.  Thank you.  That made all the difference.   That dropped it to 0.6 seconds (even in debug mode).
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels