BlazorDatasheet icon indicating copy to clipboard operation
BlazorDatasheet copied to clipboard

Performance issue when using "Insert row(s) above)" on large dataset

Open kei-soft opened this issue 5 months ago • 1 comments

Description: When using the "Insert row(s) above" option from the row header context menu in BlazorDatasheet with a large dataset (e.g., 50,000 rows), there is a significant performance delay. The UI freezes or becomes unresponsive for several seconds, making it difficult to use this feature in data-heavy scenarios.


Expected Behavior: The row insertion operation should be optimized to execute quickly and smoothly, even with large datasets. Ideally, inserting rows from the row header context menu should not cause noticeable lag or browser freezing.


Use Case: In applications where users work with large spreadsheets (e.g., 50,000+ rows), efficient row insertion is essential. Lag during such basic operations disrupts the user experience and makes the component feel sluggish compared to alternatives like Excel or Google Sheets.


Additional Context: Here's how the sheet is initialized in the BlazorDatasheet.SharedPages project (Home.razor):

_sheet = new Sheet(50000, 5);
_sheet.Rows.HeadingWidth = 35;
_sheet.Commands.PauseHistory();
_sheet.BatchUpdates();
var values = new CellValue[49999][];

After this setup, right-clicking on a row header and selecting "Insert row(s) above" results in a noticeable delay. This issue may be related to how internal structures (such as tree reindexing or data shifting) are handled during insert operations.

Optimizing this scenario would greatly improve performance and usability for large-scale data manipulation. Let me know if you need a reproducible project setup.

kei-soft avatar Jul 06 '25 13:07 kei-soft

Thanks @kei-soft this requires a restructure of the sheet's datastore but I'll definitely consider it. I've never really thought it would be used for so many rows but it would be nice to support it.

anmcgrath avatar Sep 12 '25 02:09 anmcgrath