High CPU utilization when creating EXCEL file

we are using the 4.7.X ver. of aspose dll, we are facing high cpu usage while creating an excel file,we trying to create an excel file which having around 1 lac rows and 9 columns.
We are using C# .net to genereate the xls file.

@jrethin,

Since you are using some older version of Aspose.Cells APIs, so we cannot evaluate your issue on our end. Neither we can include any fix to older version that you are using, the fixes are based on latest APIs set. We recommend you to kindly upgrade to latest version of Aspose.Cells (e.g Aspose.Cells for .NET v21.7) and if you find any issue using latest version, kindly do share your sample console application(runnable) and template file (if any), we will check your issue soon.

By the way, we have more advanced techniques to cope with performance and CPU usage while working with large files.

  1. MemoryPreference mode while loading or manipulating files, it would be useful when you are reading/writing huge files, see the document for your reference.
    Optimizing Memory Usage while Working with Big Files having Large Datasets|Documentation

  2. The other option is Aspose.Cells provides Light Cells APIs to improve performance and efficiency, as described in the next article.
    Using LightCells API|Documentation

Thank you, i have used the light cells Api and created a console application to generate excel file, i have tested this in different counts of records, the memory consumption is okay, but the CPU usage is still high, if I use 10K records to create the excel, the CPU usage is went up to 60% from 10%. I have used the same sample explained in the link.
please let me know if i have missed anything.

@jrethin,

Please create a standalone console application (runnable) using latest version of the APIs, zip the project and post here to show the issue, we will check it soon.

PS. When zipping the VS.NET project, please exclude Aspose.Cells.Dll to minimize the size of the zipped archive.

Please see the attached filesAsposePOC.zip (5.7 MB)
TableScript.zip (683 Bytes)

  1. Table structure is given in the ‘TableScript.sql’ file please run the script.

  2. Program is zipped in the file ‘AsposePOC.zip’

  3. Please change the connection string value.

also we are using around 2.5 lac records to write the excel file
Thank you
Rethin

@jrethin,

I am not sure about your actual data in your SQL Server database table. Also, in the LightCells implementation in your code, you are doing nothing; you are not inserting any data using StartCell method in the implementation of LightCellsDataProvider interface. I guess the high CPU usage issue is either with your connection with SQL Server or data importing using Worksheet.Cells.ImportData method (which is understandable since the data to be imported is huge).

We also recommend you to kindly do decrease data import (minimize the number of records (if possible), e.g. 30K-40K) per worksheet. For example, one sheet should not contain more than 30K records. You may add/create multiple worksheets in the workbook. This will give better performance.

Moreover, if you still think it is an issue with LightCells APIs, kindly do create a DataTable dynamically in code and provide updated sample code to show the issue, we will check it soon.

thank you for the comments, can we get some sample for the Startcell method, or is it available in the Git
please let us know

See the example code in the document for your reference.

Hi ,

which Aspose Cell ver is stable - 22.8?
We are planning to upgrade the ver.

@jrethin,

Yes, Aspose.Cells for .NET v22.8 is the latest available (stable) version.