XlsxFormatProvider.Export() performance

2 Answers 11 Views
SpreadProcessing
Doug
Top achievements
Rank 1
Iron
Iron
Veteran
Doug asked on 11 Jun 2025, 08:40 PM

I've seen a couple other posts here about export performance, but they both refer to relatively large amounts of data. I am having issues so I stripped my example down to the where it's exporting a blank spreadsheet (see code below) but it still takes over 10 seconds running in debug on my laptop. I'm using this in the context of a Blazor app and since this is synchronous the page hangs while the export is running. What can I do to speed this up?


            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets.Add();

            IWorkbookFormatProvider formatProvider = new XlsxFormatProvider();
            using MemoryStream ms = new();
            formatProvider.Export(workbook, ms, new TimeSpan(0, 0, 30)); // This takes over 10 seconds

            _fileData = ms.ToArray(); // byte array that the Blazor component reads

2 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 12 Jun 2025, 10:28 AM

Hello, Doug,

I am sorry to hear that you are facing any performance difficulties with the SpreadProcessing libraries.

Following the provided information, I was unable to reproduce the issue you are facing. Please refer to the screenshot below illustrating the measured time on my end with the latest version:

        static void Main(string[] args)
        {
            Stopwatch sw = new Stopwatch();
            sw.Start();
            Workbook workbook= new Workbook();
            Worksheet worksheet = workbook.Worksheets.Add();

            IWorkbookFormatProvider formatProvider = new XlsxFormatProvider();
            using MemoryStream ms = new();
            formatProvider.Export(workbook, ms, new TimeSpan(0, 0, 30)); // This takes over 10 seconds

            byte[] _fileData = ms.ToArray(); // byte array that the Blazor component reads

            sw.Stop();
            Debug.WriteLine($"Elapsed time: {sw.ElapsedMilliseconds} ms");
        }

I have attached my sample project. Please give it a try and see how it works on your end. Am I missing something? Could you please specify the exact steps how to reproduce the problem? Feel free to modify the project in a way to reproduce the experienced issue and get back to me with it so I can investigate the precise case. Thank you in advance. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Doug
Top achievements
Rank 1
Iron
Iron
Veteran
commented on 12 Jun 2025, 03:27 PM

Dess,

Thanks for the quick response. Running your console app I get the same results you do. So I created a new Blazor WebAssembly standalone app (attached) and pasted the same code into the OnInitializedAsync method of the Home page. Running it that way the export now takes a long time. So apparently there's something about it being incorporated into a Blazor app that's interfering with the export. Any ideas?

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 16 Jun 2025, 12:40 PM

Hi, Doug,

Thank you for confirming the results in both environments and for clarifying that the performance issue is specific to Blazor WebAssembly.

Indeed, the same code takes more time when it is run in a WASM app: <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

 

After discussing the case with the team and putting some efforts to measure the time for all the internal parts of the creation process of a workbook and exporting it, we have come to a conclusion that half of the time (4-5 seconds) comes from the document processing part. The rest of the time (from 4-5s to 10s) comes from the WASM itself and we do not have any control on it:

Why Export Is Slow in Blazor WebAssembly

  • Blazor WebAssembly runs entirely in the browser, which imposes significant performance and memory constraints compared to running on a desktop or server.
  • The .NET runtime in WebAssembly is slower for CPU- and memory-intensive operations, such as exporting even a simple XLSX file, due to the browser sandbox and the nature of WebAssembly execution.
  • This performance limitation is expected for complex libraries like Telerik Document Processing when used client-side in WebAssembly.

Optimization Possibilities in Blazor WebAssembly

  • There are currently no specific settings or optimizations in the Document Processing libraries that will significantly improve export speed within Blazor WebAssembly. We already have two public items related to WASM. You can cast your vote for the item, track its progress, subscribe for status changes, and add your comments on the following links: 

                SpreadProcessing: Slow performance when auto fitting rows/columns in WASM

                SpreadProcessing: Low performance in WASM when importing worksheet with formatting applied on the cells inside

  • Keeping the export logic as simple as possible and minimizing data size can help, but the gains are generally marginal in WebAssembly.
  • Offloading heavy processing from the UI thread (e.g., using Task.Run) does not improve the situation in Blazor WebAssembly, as all code executes on a single thread in the browser.

Recommended Approaches

Questions and Next Steps

Is client-side export within Blazor WebAssembly a strict requirement for your application, or could you consider moving the export to the server?

I hope you find this information helpful. Please, let me know if there is anything else I can assist you with.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
SpreadProcessing
Asked by
Doug
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or